search by tags

for the user

adventures into the land of the command line

unfortunately i have to learn some php basics...

So.. *rolls eyes* I just learnt that when you install php packages, with whatever package manager you are using, you also have to enable the package for the version of php you are using, or at the very least you should check if it has been enabled after it was installed… why? i don’t know… but say I check on my computer if php-imagick is installed:

$ dpkg -l | grep php-imagick
ii  php-imagick                         3.4.2-2+donate.sury.org~trusty+1                       amd64        Provides a wrapper to the ImageMagick library

Ok it’s installed. But is it enabled?

$ php -i | grep -i imagick

If you get no output it means no.. so you could try to do this to enable it:

$ phpenmod imagick
WARNING: Module php-imagick ini file doesn't exist under /etc/php/7.1/mods-available

But if it didn’t work, you could just try and upgrade it or re-install it:

$ apt-get install php-imagick
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  php-imagick
1 upgraded, 0 newly installed, 0 to remove and 229 not upgraded.
Need to get 180 kB of archives.
After this operation, 8,192 B of additional disk space will be used.
Get:1 http://ppa.launchpad.net/ondrej/php/ubuntu/ trusty/main php-imagick amd64 3.4.3~rc2-2+deb.sury.org~trusty+1 [180 kB]
Fetched 180 kB in 0s (2,896 kB/s)   
(Reading database ... 60150 files and directories currently installed.)
Preparing to unpack .../php-imagick_3.4.3~rc2-2+deb.sury.org~trusty+1_amd64.deb ...
Unpacking php-imagick (3.4.3~rc2-2+deb.sury.org~trusty+1) over (3.4.2-2+donate.sury.org~trusty+1) ...
Setting up php-imagick (3.4.3~rc2-2+deb.sury.org~trusty+1) ...

And after doing either of the previous two things, when you check again if it is enabled:

$ php -i | grep -i imagick
/etc/php/7.1/cli/conf.d/20-imagick.ini,
imagick
imagick module => enabled
imagick module version => 3.4.3RC2
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
Imagick compiled with ImageMagick version => ImageMagick 6.7.7-10 2016-11-29 Q16 http://www.imagemagick.org
Imagick using ImageMagick library version => ImageMagick 6.7.7-10 2016-06-01 Q16 http://www.imagemagick.org
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0
imagick.skip_version_check => 1 => 1

Yea, high five. If you are using something like php-fpm, remember you have to restart it to reload the module.

$ service php7.1-fpm restart
    php7.1-fpm stop/waiting
    php7.1-fpm start/running, process 64384

You can also check a complete list of enabled php packages like this:

$ php -m
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gettext
hash
iconv
igbinary
imagick
intl
json
libxml
mbstring
memcached
mongodb
msgpack
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zlib

[Zend Modules]
Zend OPcache

So lame