php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81205 GD extension does not load
Submitted: 2021-06-28 14:44 UTC Modified: 2021-06-30 22:43 UTC
From: buschmann at nidsa dot net Assigned: cmb (profile)
Status: Closed Package: GD related
PHP Version: 8.1.0alpha2 OS: Windows Server 2019 64bit
Private report: No CVE-ID: None
 [2021-06-28 14:44 UTC] buschmann at nidsa dot net
Description:
------------
When using our longtime php.ini file (unchanged) for 8.1alpha2 testing, The GD module fails to load with 2 identical error messages in the log file:

[28-Jun-2021 14:25:14 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'gd' (tried: N:\Apache\php8\ext\gd (Das angegebene Modul wurde nicht gefunden), N:\Apache\php8\ext\php_gd.dll (Das angegebene Modul wurde nicht gefunden)) in Unknown on line 0
[28-Jun-2021 14:25:14 UTC] PHP Warning:  PHP Startup: Unable to load dynamic library 'gd' (tried: N:\Apache\php8\ext\gd (Das angegebene Modul wurde nicht gefunden), N:\Apache\php8\ext\php_gd.dll (Das angegebene Modul wurde nicht gefunden)) in Unknown on line 0

This means in english, that the specified module could not be found.

A check in the ext directory shows the file php_gd.dll
(Standard distribution thread safe 64bit for Windows from php website)

This worked well in 8.1.alpha1 and 8.0 all versions.

In the working cases GD section is shown in info.php

Test script:
---------------
below part of the running php.ini
...
; Windows Extensions
; Note that ODBC support is built in, so no dll is needed for it.
; Note that many DLL files are located in the extensions/ (PHP 4) 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=bz2
;extension=curl
;extension=fileinfo
extension=gd
;extension=gettext
;extension=gmp
;extension=intl
;extension=imap
;extension=interbase
;extension=ldap
extension=mbstring
extension=exif      
							; Must be after mbstring as it depends on it
;							; HB disabled mysql to test MySql_Functions wrapper tool
;extension=mysql
;extension=mysqli
;extension=oci8      ; Use with Oracle 10gR2 Instant Client
;extension=oci8_11g  ; Use with Oracle 11gR2 Instant Client
;extension=openssl
;extension=pdo_firebird
;extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
;extension=pdo_sqlite
extension=pgsql
;extension=pspell
;extension=shmop

...


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-06-28 14:47 UTC] cmb@php.net
-Package: Dynamic loading +Package: GD related
 [2021-06-28 14:47 UTC] cmb@php.net
Make sure that avif.dll is in the PATH.
 [2021-06-28 19:51 UTC] buschmann at nidsa dot net
avif.dll is in the php8 directory (where php.exe exists)
It is the unmodified extraction from the zip from the php website.

This php extraction directory is not declared in the path variable (like many years now)
There has been the change between 8.1 alpha1 and alpha2
 [2021-06-29 09:11 UTC] cmb@php.net
> There has been the change between 8.1 alpha1 and alpha2

8.1.0alpha2 introduced AVIF support, and currently avif.dll is
built as dynamic library.  There is a PR to build it
statically[1], and this is likely to be merged, and then there
will be no more avif.dll.  But for now, you need to put avif.dll
in the PATH.

[1] <https://github.com/winlibs/libavif/pull/2>
 [2021-06-29 13:37 UTC] buschmann at nidsa dot net
I added the php distribution directory (N:\Apache\php8) to the systemwide PATH variable and restarted Apache service.

GD now loads without problems in 8.1.alpha2 (seen in info.php)

Thanks for showing this solution.

To avoid this configuration change a final solution should detect the avif.dll automatically in the php distribution directory (or static linking).
 [2021-06-29 15:27 UTC] cmb@php.net
> To avoid this configuration change a final solution should
> detect the avif.dll automatically in the php distribution
> directory (or static linking).

The latter is fine, but the former would be pretty unusual, and
after all, there are several other DLLs in that folder which would
require the same treatment (e.g. sqlite3.dll, libssl-1_1-x64.dll)
(which is documented for the respective extensions, e.g.
openssl[1]).  Actually, I'm surprised that you haven't faced other
issues; either you don't use these extensions, or they used DLLs
from another folder.

[1] <https://www.php.net/manual/en/openssl.installation.php>
 [2021-06-30 22:43 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-06-30 22:43 UTC] cmb@php.net
The 8.1 and master series have been updated to use libavif-0.9.0-1
which has static libraries, so PHP 8.1.0alpha3 will not require
avif.dll anymore.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 01 20:01:29 2024 UTC