DEV Community

Cover image for How to Install PHP GD Extension on Windows WAMP and XAMPP Server
Code And Deploy
Code And Deploy

Posted on • Edited on

How to Install PHP GD Extension on Windows WAMP and XAMPP Server

Originally posted @ https://codeanddeploy.com visit and download the sample code: https://codeanddeploy.com/blog/php/how-to-install-php-gd-extension-on-windows-wamp-and-xampp-server

Advanced Laravel SAAS Starter Kit with CRUD Generator

Advanced Laravel SAAS Starter Kit with CRUD Generator - GET YOUR COPY NOW!

Do you need to install PHP GD Extension? Don't worry I got you. In this post, I will share with you how to install PHP GD Extension in your windows. This extension is important if you have the functionality to create and manipulate images in PHP. Kindly follow the simple steps below.

First, check if "php_gd2.dll" is already exists in your extension web server directory. If you're using Xampp you will find it here "C:\xampp\php\ext".

Second, if "php_gd2.dll" the extension is not yet existing kindly download it here and upload it to your web server extensions directory or here "C:\xampp\php\ext".

Third, then if the above is already checked then open the "php.ini" file to your editor which is can be found in this directory "C:\xampp\php\" then search inside the "php.ini" file.

Fourth, once you found the "extension=gd2" then if you see like this ";extension=gd2" this is commented that's why GD extension is not enabled. Now we will enable this by removing the ";" (comma).

//change the following line 
;extension=gd2

//to this
extension=gd2
Enter fullscreen mode Exit fullscreen mode

NOTE: If you can't found the "extension=gd2" then you must add this line under "Dynamic Extensions" inside the "php.ini" file. Just see the following file below:

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

; If you wish to have an extension loaded automatically, use the following
; syntax:
;
;   extension=modulename
;
; For example:
;
;   extension=mysqli
;
; When the extension library to load is not located in the default extension
; directory, You may specify an absolute path to the library file:
;
;   extension=/path/to/extension/mysqli.so
;
; Note : The syntax used in previous PHP versions ('extension=<ext>.so' and
; 'extension='php_<ext>.dll') is supported for legacy reasons and may be
; deprecated in a future PHP major version. So, when it is possible, please
; move to the new ('extension=<ext>) syntax.
;
; Notes for Windows environments :
;
; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+)
;   extension folders as well as the separate PECL DLL download (PHP 5+).
;   Be sure to appropriately set the extension_dir directive.
;

extension=gd2

extension=bz2
extension=curl
;extension=ffi
;extension=ftp
extension=fileinfo
Enter fullscreen mode Exit fullscreen mode

Fifth, now let's restart your web server.

Once your server is already restarted then let's check and confirm if the GD is already enabled to your web server. Now create a PHP file then name it as you want then add this code. Then run it. Then search GD Support and you will see the GD configuration. Then that's it you have successfully installed the GD Extension.

<?php phpinfo(); ?>
Enter fullscreen mode Exit fullscreen mode

The above steps can be useful in WAMPP and XAMPP localhost servers. I hope this tutorial can help you. Kindly visit here https://codeanddeploy.com/blog/php/how-to-install-php-gd-extension-on-windows-wamp-and-xampp-server if you want to download this code.

Advanced Laravel SAAS Starter Kit with CRUD Generator

Advanced Laravel SAAS Starter Kit with CRUD Generator - GET YOUR COPY NOW!

Happy Coding :)

Top comments (0)