The GD library is required to create and manipulate images in PHP. You need to enable GD library support for working with image functions in PHP. Here we’ll show you how to install GD library in PHP on Windows server.
In order to install PHP GD support on Windows server, follow the below steps.
- At first make sure the
php_gd2.dllfile is exists in extensions directory of PHP folder.
php_gd2.dllfile is not present in extensions directory, download it from here and insert the
php_gd2.dllfile to the extensions directory.
- Open the
php.inifile in a text editor and check whether the
php_gd2.dllextension has already been added. (;extension=php_gd2.dll)
;extension=php_gd2.dllis exists in
php.inifile, enable GD extension by uncommenting the
extension=php_gd2.dllline. Uncomment can be done by deleting the leading
;from the extension.
// change the following line from ... ;extension=php_gd2.dll // ... to extension=php_gd2.dll
- To include
php_gd2.dllas an extension, add the following line in
- Restart the Windows server.
To check whether GD library is installed in PHP, run the following code. It will display information about the PHP’s configuration. Search for GD Support, you’ll see the information about the GD configuration.
<?php phpinfo(); ?>
Follow the same steps described above to install PHP GD library in XAMPP or WAMP server.