logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Third-party Modules View previous topic :: View next topic
Reply to topic   Topic: Getting php GD to load - Win11 dev host
Author
iainh



Joined: 19 Feb 2025
Posts: 4
Location: UK

PostPosted: Fri 07 Mar '25 17:36    Post subject: Getting php GD to load - Win11 dev host Reply with quote

I have tried many things but I cannot get php GD to load on my Win11 dev environment. I have done considerable research, all offering 'sure-fire solutions', but all have failed. Trying all this advice has led to many combinations of attempts all to no avail. I get no error, just GD doesn't load.

[Environment]
    Windows 11
    Apache/2.4.63 (Win64)
    PHP/7.4.33 (I have different versions of php as part of migration to 8.4

[php.ini]
    extension=gd is uncommented and tried as both 'gd' and as ...
    extension=gd2

    extension=php_gd2.dll is uncommented
    extension_dir = "/php/php7-4-33/ext" is set and uncommented. Also tried as...
    extension_dir = "c:\php\php7-4-33\ext"

Everything is not under /php due to switching between between different versions of php as a part of migration. I can update httpd.conf to report to different php interpreters and so test across versions and find break points.

I have also tried :
    php_gd2.dll renamed as php_gd.dll without success
    php_gd2.dll has been placed in c:\windows\system32

There is no error on restarting Apache. httpd -k restart completes just fine ... but GD steadfastly refuses to load. No error, just not there (checked by both php -m and phpinfo() output)

[httpd.conf]
    PHPIniDir "c:/php/php7-4-33/"
    LoadModule php7_module "c:\php\php7-4-33\php7apache2_4.dll"

Also tried
    PHPIniDir "c:\php\php7-4-33"
    PHPIniDir "c:\php\php7-4-33\"

I have no problem on live Linux boxes, but convincing GD to load on Windows dev is beating me at the moment. Any advice. I suspect it's something trvial!

One observation as I continue with this issue. phpinfo() shows:
Code:
Configuration File (php.ini) Path      no value
Loaded Configuration File              C:\php\php.ini

Odd that the php file path has 'no value', yet the correct php.ini is loaded. How is possible to load the correct file without knowing its location?

Final observation...
php -m does NOt list GD. But phpinfo() is now showing GD support enabled and it is indeed working. Somehow 'messing' with the httpd.conf PHPIniDir value resolved the issue, but interesting, php -m is telling fibs!

For anyone else having this challenge and finding this, I have...

[httpd.conf]
    PHPIniDir "c:\php"
    LoadModule php7_module "c:\php\php7-4-33\php7apache2_4.dll"

Note, you MUST NOT have a trailing "\" on PHPIniDir, i.e. "c:\php\" will break loading the php.ini. Also, my php7apache2_4.dll is nested a level down due to running/switching between multiple php versions.

[php.ini]
    extension=gd
    extension=php_gd2.dll

All the advice of the gd2.dll being renamed to just gd.dll seem wrong (although I think php 8 drops the '2'), copying to the php root directory, /system32, putting absolute paths on the location of gd2.dll and many other 'suggestions' proved not to work. Hopefully this 'adventure' may be of some use to someone else in the future 😊
Back to top
Otomatic



Joined: 01 Sep 2011
Posts: 246
Location: Paris, France, EU

PostPosted: Sun 09 Mar '25 19:03    Post subject: Reply with quote

Hi,

Wampserver configuration for PHP 7.4.33 used as an Apache 2.4.63 module

-- PHP 7.4.33
- php.ini
extension_dir ="E:/wamp64/bin/php/php7.4.33/ext/"
extension=gd2

-- Apache 2.4.63
- httpd.conf
PHPIniDir "E:/wamp64/bin/apache/apache2.4.63/bin"
LoadModule php7_module "E:wamp64/bin/php/php7.4.33/php7apache2_4.dll"

In the apache bin folder (E:/wamp64/bin/apache/apache2.4.63/bin/), there are symbolic links to some PHP 7.4.33 dlls and to its php.ini file:

<SYMLINK> icudt66.dll [E:/wamp64/bin/php/php7.4.33/icudt66.dll]
<SYMLINK> icuin66.dll [E:/wamp64/bin/php/php7.4.33/icuin66.dll]
<SYMLINK> icuio66.dll [E:/wamp64/bin/php/php7.4.33/icuio66.dll]
<SYMLINK> icuuc66.dll [E:/wamp64/bin/php/php7.4.33/icuuc66.dll]
<SYMLINK> libcrypto-1_1-x64.dll [E:/wamp64/bin/php/php7.4.33/libcrypto-1_1-x64.dll]
<SYMLINK> libpq.dll [E:/wamp64/bin/php/php7.4.33/libpq.dll]
<SYMLINK> libsasl.dll [E:/wamp64/bin/php/php7.4.33/libsasl.dll]
<SYMLINK> libsodium.dll [E:/wamp64/bin/php/php7.4.33/libsodium.dll]
<SYMLINK> libsqlite3.dll [E:/wamp64/bin/php/php7.4.33/libsqlite3.dll]
<SYMLINK> libssh2.dll [E:/wamp64/bin/php/php7.4.33/libssh2.dll]
<SYMLINK> libssl-1_1-x64.dll [E:/wamp64/bin/php/php7.4.33/libssl-1_1-x64.dll]
<SYMLINK> php.ini [E:/wamp64/bin/php/php7.4.33/php.ini]
<SYMLINK> php7ts.dll [E:/wamp64/bin/php/php7.4.33/php7ts.dll]

In httpd.conf and php.in, for paths, use slashes / and not backslashes.
Back to top
iainh



Joined: 19 Feb 2025
Posts: 4
Location: UK

PostPosted: Mon 10 Mar '25 13:06    Post subject: Reply with quote

Otomatic wrote:
Hi,

Wampserver configuration for PHP 7.4.33 used as an Apache 2.4.63 module...

Thanks, however I'm not usig WAMP and I'm also on Windows (this is just a dev laptop, not a Linux server), so no WAMP config and no symbolic links, just httpd.conf (and additional .confs) and php.ini. I have always just installed Apache and then php. WAMP never seemed to help things.

I have GD working with php 7.4.33 but on switching to php 8.3.3 and 8.4.4 GD failed to load, but I need to do look further at why. Strange given it's the same php.ini 😔

My current problem is getting sockets working with 7.4.33 and extending 'Registered Stream Socket Transports' beyond just tcp and udp. So far, all the advice about uncommenting...
Code:
extension=sockets
extension=php_sockets.dll

have failed to get things working.

One step forward and another one back 😂
Back to top
Otomatic



Joined: 01 Sep 2011
Posts: 246
Location: Paris, France, EU

PostPosted: Mon 10 Mar '25 17:57    Post subject: Reply with quote

Hi,

For PHP 7.4.33 it is:
extension=gd2

For PHP 8.4.4 it is
extension=gd

Quote:
extension=php_sockets.dll

Starting with PHP 7.2.0, you must not put "php_" at the beginning of the extension name, nor .dll at the end.

If we look at the "php.ini-development" files of the different PHP versions of https://windows.php.net/download/ we can see :
- PHP 7.4.33
;extension=fileinfo
;extension=gd2
;extension=gettext

- PHP 8.4.4
;extension=fileinfo
;extension=gd
;extension=gettext

- PHP 7.0.0
;extension=php_fileinfo.dll
;extension=php_gd2.dll
;extension=php_gettext.dll

Extract from: https://www.php.net/manual/en/image.installation.php
In Windows, you'll include the GD DLL php_gd.dll as an extension in php.ini. Prior to PHP 8.0.0, the DLL was named php_gd2.dll.

Quote:
WAMP never seemed to help things.

Question Wink Except that you can use it from PHP 5.6.40 to PHP 8.4.4 without any problem, and even have the same local site under several different PHP versions.
Back to top


Reply to topic   Topic: Getting php GD to load - Win11 dev host View previous topic :: View next topic
Post new topic   Forum Index -> Third-party Modules