PHP-GD Installation – How to Install PHP-GD on CentOS 7 with PHP 5.6.40

centos7gdphp56

I have a PHP 5.6.40 server on which I am trying to install/enable the GD image library….with no success.

I've tried to install the following package

yum install php-gd
yum install php5-gd
yum install php56-php-gd

The first package (php-gd) errors out with dependency resolution errors.

Error: Package: php-gd-5.4.16-46.1.el7_7.x86_64 (updates)
           Requires: php-common(x86-64) = 5.4.16-46.1.el7_7
           Installed: php-common-5.6.40-12.el7.remi.x86_64 (@remi-php56)
               php-common(x86-64) = 5.6.40-12.el7.remi
           Available: php-common-5.4.16-46.el7.x86_64 (base)
               php-common(x86-64) = 5.4.16-46.el7
           Available: php-common-5.4.16-46.1.el7_7.x86_64 (updates)
               php-common(x86-64) = 5.4.16-46.1.el7_7
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

The second package (php5-gd) shows with the 'No package available' error.

The latter installs all the way through, but the GD module is still not enabled after restarting the HTTPD service and running phpinfo();

Package php56-php-gd-5.6.40-14.el7.remi.x86_64 already installed and latest version

Any ideas how to get this installed and running.

My Base os is Centos 7 (CentOS Linux release 7.6.1810)

I'm really not sure how to get this module installed.

Any help appreciated.

Kind Regards

James

Best Answer

You have install PHP 5.6.40 from a repository which is not enabled (@remi-php56), so you have to enable it for additional extension

As explained by the wizard.

yum-config-manager --enable remi-php56
yum update
yum install php-gd

Notice: PHP 5.6 is now EOL so I hearthly recommend to upgrade to a supported version (7.1+)

P.S. this will also pull 5.6.40-14 (instead of 5.6.40-12) which includes some more security fixes.