I'm trying to install php7.2-gd on my production server.

I have 2 servers -- one for dev and one for prod. When I run this installation in our dev server, everything is fine. When I tried doing this in our prod server, I'm getting the following error:

$ apt-cache search php-gd
php-gd - GD module for PHP [default]
php7.1-gd - GD module for PHP
$ apt-get install php7.2-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.2-gd
E: Couldn't find any package by glob 'php7.2-gd'
E: Couldn't find any package by regex 'php7.2-gd'

Additionally, I tried the following commands:

add-apt-repository ppa:ondrej/php
apt update && apt upgrade
apt-get install php7.2-gd

Still getting the error after the steps above. The php version in dev is just the same in prod. Even our ubuntu versions are the same in both servers. So I'm not really sure what else I need to do in order to install php7.2-gd in prod.

Is there a way to know why it's not picking up the php7.2-gd extension?

Version: Ubuntu 17.10 (GNU/Linux 4.13.0-36-generic x86_64)


I tried installing php-gd as suggested but it is not working as expected because the gd.so file and the gd.ini are not in the normal directories where the other extensions are saved.

My .so extensions are normally installed in /usr/lib/php/20170718 But exploring the other folders, the gd.so was saved in /usr/lib/php/20160303

What do I need to do to correct this problem? the extension is not being recognized after apache restart.

  • 1
    php7.2-gd is only available in Ubuntu 18.04 and php7.1-gd (from your cache searches) is only available in 17.10. The ppa you use doesn't have that package. What is available in all repos is the package php-gd which links to the latest versions. So please check your system versions and /etc/apt/sources.list and consider using the packages without version name. – Christopher Perrin Oct 23 '18 at 10:29
  • That make sense. I did try to install php-gd only but doesn't do anything. the .so is still missing in the php library (in this folder /etc/php/7.2/). – primerg Oct 23 '18 at 13:15
  • Which version of Ubuntu is this?! – Michael Hampton Oct 23 '18 at 14:12
  • @MichaelHampton Ubuntu 17.10 (GNU/Linux 4.13.0-36-generic x86_64) – primerg Oct 23 '18 at 23:24
  • How did that get into production?!? It's already EOL. Update ASAP to an LTS release. – Michael Hampton Oct 23 '18 at 23:36

Try to download the direct deb package of php7.2-gd.deb. Here is the download link http://ftp.br.debian.org/debian/pool/main/p/php7.2/php7.2-gd_7.2.11-2_amd64.deb and then install it with following command. dpkg -i <>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.