How to Install Gd on My Windows Server Version of PHP

How do I install GD on my windows server version of PHP

Check php_gd2.dll is in your extension directory and uncomment ;extension=php_gd2.dll of your php.ini.

Enable GD support in PHP

Following are the steps for any php extension (on MS-Windows):

  1. Give absolute path (not relative) to extensions directory [use forward slashes (/) instead of backslashes (\); I'm not too sure whether it's required to end the path with trailing slash.
    • e.g.: extension_dir = c:/php5/ext
  2. Make sure php is referring your php.ini, now php.ini can be inside your php installation root dir.
    • If your changes to php.ini are reflected on phpinfo(), it's OK. If not, please refer to INSTALL file in php root dir.
  3. Restart apache if you're binding php as a module to apache

Enable GD support on PHP 7.2 in a Ubuntu 18.04

This command will install the GD extension only if PHP 7.2 is already installed.

If not, it will also install php7.2-common since it is a dependency.

On a machine without PHP 7.2:

sudo apt install php7.2-gd

Reading package lists... Done
[...]
The following additional packages will be installed:
php7.2-common
The following NEW packages will be installed:
php7.2-common php7.2-gd

and with PHP 7.2 installed:

sudo apt install php7.2-gd

Reading package lists... Done
[...]

The following NEW packages will be installed:
php7.2-gd

Once installed, the GD config files will be created under /etc/php/7.2/(fpm|cli...)/conf.d and should be named xx-gd.ini.

These config files are loaded after your main php.ini and contain extension specific settings (in your case, GD settings).

GD Library extension not available with this PHP installation Ubuntu Nginx

The GD Graphics Library is for dynamically manipulating images.
For Ubuntu you should install it manually:

  • PHP7.4: sudo apt-get install php7.4-gd
  • PHP8.0: sudo apt-get install php8.0-gd
  • PHP8.1: sudo apt-get install php8.1-gd

That's all, you can verify that GD support loaded:

php -i | grep -i gd

Output should be like this:

GD Support => enabled
GD headers Version => 2.1.1-dev
gd.jpeg_ignore_warning => 0 => 0

and finally restart your apache:

sudo service apache2 restart


Related Topics



Leave a reply



Submit