Php – ImageMagick suddenly stopped working on several of our servers

apache-2.2extensionimagemagickPHP

Overnight, the PECL ImageMagick extension suddenly stopped working on several of our servers. The error message displayed was as follows:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/imagick.so' - libMagickWand.so.2: cannot open shared object file: No such file or directory in Unknown on line 0

ImageMagick itself and the PECL extension have been installed and working quite happily for months prior to this. All the files referenced in the above error message were present in the given locations on the server.

All the servers are RHEL6, with a combination of either the standard PHP 5.3.3 install or v5.4.x / 5.5.x installed via third party repos.

Issuing "pecl uninstall imagick" and "pecl install imagick" seems to have fixed the problem, but I'm curious as to why this happened in the first place?

Best Answer

Since you said you are using 3rd party repos, I'm pretty sure what happened was a background yum update ran and updated the imagemagik rpm and removed the library the php module was linked against.

So when you re-installed via pecl it found the new library and re-linked.

If you run the following command over the module you will see the new library will be different then libMagickWand.so.2

ldd /usr/lib64/php/modules/imagick.so | grep libMagick