29

I am running Windows Server 2003 and need to install a version of GD.

Can anyone point out some instructions or advice?

Mazatec
  • 11,481
  • 23
  • 72
  • 108

8 Answers8

43

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

xdazz
  • 158,678
  • 38
  • 247
  • 274
  • 1
    Note, to uncomment, remove the semi-colon at the beggining of the line. – Alex Turpin Oct 21 '11 at 14:42
  • Do you have to restart any services or will PHP pick up the changes dynamically? – HPWD Jan 01 '15 at 22:18
  • 1
    yes, restart apache with `sudo service apache2 restart` – cari Sep 26 '16 at 09:42
  • And what if the php_gd2.dll is missing? – mqbaka mqbaka Aug 05 '21 at 07:35
  • 1
    Note that if you have `extension_dir` set, the path must match. In newer PHP versions you don't enter the module dll name (extension_dir = php_gd2.dll) anymore. You enter only whats between php_ and .dll (`extension_dir = gd2` in this case). If a module doesn't work, I'm going to cmd and executing `php -m` to see the error message – Deivid As Oct 08 '21 at 07:54
29

It was in my c:\xampp\php\php.ini

;extension=gd

This was commented out as you can see, removing ; and restarting apache server fixed my problem.

CFNinja
  • 3,571
  • 4
  • 38
  • 59
  • 1
    Working in Laravel, the `artisan server` must be restarted to reflect the changes made in `php.ini`. Uncommenting the line containing `;extension=gd` and restarting the server fixed my problem. – Aamir Khan Maarofi Jun 09 '21 at 09:49
  • I literally tried everything, restarted XAMPP several times, but it didn't come to my mind that I was running the server via Artisan and I had to restart that ... thank you kind stranger! – Svetoslav Stefanov Mar 10 '23 at 12:23
13

After PHP 8.0, GD extension name changed from php_gd2.dll to php_gd.dll

extension=php_gd.dll

https://php.watch/versions/8.0/gd2-gd-windows

Vitalicus
  • 1,188
  • 13
  • 15
5

To enable GD image library on PHP 8 open your php.ini file, find your extensions section and add into it: extension=gd

It will looks like:

[ExtensionList] extension=gd


  • I´m using Windows with PHP 8; so, after change restart your webserver.

** tks to this article: https://write.corbpie.com/how-to-enable-gd-library-with-xampp-php-8-on-windows/

user2530225
  • 59
  • 1
  • 1
4

You need to edit your php.ini (found in your C:/PHP folder if you installed PHP here). Add the following line (or remove the ; before it if it exists in there):

extension=php_gd2.dll

Richard Edwards
  • 2,000
  • 1
  • 12
  • 19
3

Issue was resolved. I am using XAPP.

I tried to search for "extension=php_gd2.dll" file in "php.ini" file but there was no such thing there (";extension=php_gd2.dll" was also not there with a semicolon). Then I included the statement "extension=php_gd2.dll" myself in php.ini file. Also, I downloaded the the file "extension=php_gd2.dll" from https://www.dll-files.com/php_gd2.dll.html and placed it in folder "C:\xampp\php" (there is also another folder C:\xampp\php\ext where other extensions reside but anyway this method did not work). Then I restarted Apache and MySQL from xampp-control.exe. It did NOT work.

I RESET all the changes I made in the previous step.

Tried the other method:

opened "php.ini" file (at C:\xampp\php) and looked for "extension=gd". I noticed that there was a semicolon present with the searched word and it appeared as ";extension=gd". I removed semicolon. Saved the php.ini file. Stopped and restarted Apache from xampp-control.exe.

Now it works.

So what exactly was resolved? When I was selecting logo image on wordpress at Customizing ▸ Default/Basic Setting ▸ Site Identity, I was unable to crop it earlier. After following the second step, it works. Now I can crop files.

1

In Windows download related Debug Pack on php.net download page, it's contain most useful modules. After, uncomment related extension, for example to gd2: ;extension=php_gd2.dll on php.ini and uncomment extension_dir = "ext".

FVVID
  • 155
  • 1
  • 9
1

GD wasn't working for me even though it was installed in the extension folder. My issue was with the php.ini file which was referenced to extension=php_gd2.dll instead of extension=php_gd.dll.

Bobby Bridgeman
  • 121
  • 1
  • 2
  • So happy to found this as I had exactly the same issue. Switching to php_gd.dll solved the problem - thank you! – Balael Apr 25 '21 at 19:13