phpupgradephp-7.3

PHP Warning - PHP Startup: Unable to load dynamic library 'imagick.so'


Has anyone come across this warning before? Any files I should check other than php.ini or 00-ioncube.ini? Those look to be in good order.

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

PHP 7.3.31 (cli) (built: Sep 21 2021 10:24:03) ( NTS )

Operating System:
Operating System: CentOS Linux 7 (Core)
     CPE OS Name: cpe:/o:centos:centos:7
          Kernel: Linux 3.10.0-1160.42.2.el7.x86_64
    Architecture: x86-64

I upgraded PHP from version 7.1 to 7.3 on using these steps:

php -v
sudo yum install epel-release
yum --enablerepo=remi-php73 install php 
php -v 
systemctl restart httpd

I only see one php.ini file loaded in /etc/


Solution

  • Check how was the imagick extension was installed:

    rpm -qf /usr/lib64/php/modules/imagick.so
    

    It looks like it is not provided by a RPM, nor built for the proper PHP version you are running (libMagickWand.so.5 is also an old version).

    For a proper configuration / installation, see the Wizard instructions

    At least I recommend you enable the remi-php73 repository permanently, to ensure all extensions are taken from it.

    yum-config-manager --enable   remi-php73
    

    Then you can install the imagick extension, or any other extension you need

    yum install php-imagick
    

    Notice, in this repository you have the choice between 2 variants of this extension, above command will pick one among:

    APIs are slightly different.