How to enable GD library in localhost Xampp

Open the php.ini file:

Locate the php.ini file in your XAMPP installation directory. It’s typically found in C:\xampp\php\php.ini on Windows.

php.ini

Find the GD library section:

gd-find

  • Open the php.ini file in a text editor.
  • Search for the line containing ;extension=gd or ;extension=gd2. The semicolon (;) at the beginning of the line indicates that the extension is commented out and therefore not active.

Uncomment the GD library extension:

Remove the semicolon (;) at the beginning of the line to uncomment it. It should look like this:

remove-semicolon

extension=gd

or

extension=gd2

Save the php.ini file:

After uncommenting the line, save the changes to the php.ini file.

Restart Apache:

For the changes to take effect, you need to restart the Apache server. You can do this via the XAMPP Control Panel by clicking “Stop” and then “Start” next to Apache.

Verify GD library is enabled:

  • To verify that the GD library is enabled, you can create a PHP file (e.g., info.php) with the following content:
<?php
phpinfo();
?>
  • Access this file in your browser via http://localhost/info.php and look for the “gd” section. If the GD library is enabled, you’ll see details about it there.

Leave a Comment