Unable to load dynamic library ‘gd’ on Virtualmin server even though php-gd is installed

You might get the following error after having done `yum install php72-php-gd` on a Virtualmin server because of a missing library:

PHP Warning: PHP Startup: Unable to load dynamic library 'gd' (tried: /opt/rh/rh-php72/root/usr/lib64/php/modules/gd (/opt/rh/rh-php72/root/usr/lib64/php/modules/gd: cannot open shared object file: No such file or directory), /opt/rh/rh-php72/root/usr/lib64/php/modules/gd.so (/opt/rh/rh-php72/root/usr/lib64/php/modules/gd.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

The reason could be that on a Virtualmin server, with multiple versions of PHP, there is now confusion between the Remi folder locations and the actual locations on disk. The solution is to copy gd.so from:

/opt/remi/php72/root/usr/lib64/php/modules

to

/opt/rh/rh-php72/root/usr/lib64/php/modules

and then service httpd restart

Note:
Also check that the 20-gd.ini file exists in /etc/opt/rh/rh-php72/php.d/20-gd.ini

 

 

Tags

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top