ImageMagick 7 with PHP bindings
Hi all, I've seen lots of threads around this subject, so just to show I've done some research:
forum.remirepo.net/viewtopic.php?pid=10316#p10316
- my thread on this subject on Remi's forum (but I suspect this problem is not his responsibility)
forumweb.hosting/13983-how-to-install-imagemagick-on-centos.html'
- installs the Remi rpm's for ImageMagick command line tools, but does not talk about PHP bindings
stackoverflow.com/questions/31933348/imagemagick-install-problems-in-centos
- talks about downloading and building from source, which is not preferred if a package manager method is available
askubuntu.com/questions/858472/fatal-error-class-imagick-not-found
- addresses the 'Class Imagick not found' issue but doesn't cover my case
I need to run ImageMagick 7 on my cPanel managed server, because as far as I can tell the version ImageMagick-6.7.8.9-15.el7_2.x86_64 that comes by default does not include the lcms delegate. We have a media company delivering CMYK images to us that we need to convert on the fly to sRGB color space, and this fails when lcms is not available.
I don't have any experience of the cPanel packaging strategy, or what PHP packages ought to look like on a Centos system, but I did install a pure Centos 7.2 system on a VM and the package names differ from what I'm seeing on my cPanel managed Centos 7.2 system.
So, I can add the remi repository to my system, and install ImageMagick7 and ImageMagick7-libs from remi, no problem, and get the command line tools, which work and show the lcms delegate now available (great!) but after restarting httpd and php-fpm I get "PHP Fatal error: Class 'Imagick' not found".
Looking into more of the comments on stackoverflow.com/questions/31933348/imagemagick-install-problems-in-centos I noticed there are exclusions in the yum config on our system:
# grep -r exclude /etc/yum*
/etc/yum/pluginconf.d/fastestmirror.conf:#exclude=.gov, facebook
/etc/yum.conf:exclude=courier* dovecot* exim* filesystem httpd* mod_ssl* mydns* nsd* p0f php* proftpd* pure-ftpd* spamassassin* squirrelmail*
So any packages beginning with php will be excluded. I think this is why the remi repository packages for things like php-pecl-imagick are not being installed.
I see that the php packages I _do_ currently have all start with 'ea-', e.g. ea-php56-php-fpm. The remi repository packages are supposed to be 'drop-in' replacements for core Centos packages, but their names don't match the ones on my system.
So, what is the official cPanel-approved way of installing ImageMagick 7 with PHP bindings, please?
-
I came to the conclusion that I do not need ImageMagick7 at all .. all I need is an ImageMagick with the lcms delegate installed, and the version in the remi repositories do have this (both version 6 and 7). Also, when using cPanel we do not need to install the php-pecl-imagick package, which would provide imagick.so and thus enable the PHP bindings. Instead one should use the Module Installer page in WHM to re-install (or install for the first time) the imagick PECL, which will download its source code and compile it for you. (this explains why 'rpm -q --whatprovides imagick.so' reported that no package owned imagick.so on my system) I did not have to enable any of Remi's php repositories, or replace any system packages other than the ImageMagick ones, which was a relief. No need to remove the "php*" exclusion in yum.conf. See forum.remirepo.net/viewtopic.php?pid=10339 for my investigation and solution. # yum remove ImageMagick # yum --enablerepo=remi install ImageMagick6-devel -- Go to WHM control panel as described here PHP PECL - Version 74 Documentation - cPanel Documentation and click 'reinstall' for the imagick PECL. -- restart httpd with: # /scripts/restartsrv_apache_php_fpm # /scripts/restartsrv_httpd 0 -
Hi @Nick Fenwick I'm really glad you found the solution to your issue and thank you very much for posting it here in such great detail, it's much appreciated. 0
Please sign in to leave a comment.
Comments
2 comments