A Wordpress installation I am working on, for some images, is giving an error, "GD Library Error: imagecreatetruecolor does not exist - please contact your webhost and ask them to install the GD library".

How can I install and/or connect the GD Library, on an Ubuntu server, so that Wordpress sees what it needs to display these images?



Install gd:

sudo apt-get install php5-gd
/etc/init.d/apache2 restart

And verify:

php5 -m | grep -i gd

That should do the trick!


Install php GD module:

sudo apt-get install php5-gd


For PHP 7.0 use

sudo apt-get install php7.0-gd

The right way to do this is to find the version of PHP you are using and then install that version of GD:

~$ php --version
PHP 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 (cli) ...

I'm running PHP 7.3 so I check apt:

~$ apt search php7.3-gd
Sorting... Done
Full Text Search... Done
php7.3-gd/xenial,now 7.3.19-1+ubuntu16.04.1+deb.sury.org+1 i386 [installed]
  GD module for PHP

~$ sudo apt-get install php7.3-gd

~$ sudo systemctl restart apache2

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.