Php extension gd not loaded

Having an issue with php-gd

I inserted this command:

sudo apt-get install php5-curl php5-mcrypt php5-gd php5-common

throughout the process to setup Magento but when I went through Validation, this is what I got:

"PHP Extension gd must be loaded"

When the warning showed up. I tried to install it again using:

sudo apt-get install php5-gd

This was the message that I received:

"Reading package lists... Done E: Unable to locate package"

I Would like some direction on how to fix this Error.

nickhar

19.5k12 gold badges59 silver badges72 bronze badges

asked Nov 3, 2012 at 19:43

3

Restarting the webserver after installing php5-gd loads the package.

answered Apr 1, 2013 at 19:10

d gd g

1,54413 silver badges13 bronze badges

check. reloading the web server. services such as php-pfm [php5-fpm], fcgi, fastcgi, etc load once and remain in the background. Adding modules does not impact the running copy. It must be restarted to load the module into active use.

answered Nov 21, 2013 at 16:02

ppostma1ppostma1

3,5281 gold badge26 silver badges28 bronze badges

Use synaptic package manager for easier installation.

After installing and it still does not work, look at the apache modules, mine is at /etc/php5/apache2/conf.d/20-gd.ini

; configuration for php GD module
; priority=20
; extension=gd.so

Even if the module exists and is installed on the system, it is commented out on the module config. Uncomment it, then restart Apache, then you should be fine.

answered Mar 23, 2014 at 18:34

temyongtemyong

711 silver badge1 bronze badge

Bug #81205Submitted:Modified:From:Assigned:Status:Package:PHP Version:OS:Private report:CVE-ID:
GD extension does not load
2021-06-28 14:44 UTC 2021-06-30 22:43 UTC
buschmann at nidsa dot net cmb [profile]
Closed GD related
8.1.0alpha2 Windows Server 2019 64bit
No 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

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2021-06-28 14:47 UTC]

-Package: Dynamic loading +Package: GD related

 [2021-06-28 14:47 UTC]

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]

> 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] 

 [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]

> 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] 

 [2021-06-30 22:43 UTC]

-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb

 [2021-06-30 22:43 UTC]

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.

How do I enable GD?

Windows Server users.
Open your PHP. ini file in Notepad, or your preferred WYSIWYG editor. This file is normally located in the C:\Windows\ directory..
Locate the following line. ;extension=php_gd2.dll..
Remove the preceding semicolon [;] to enable the option..
Save your file..
Restart the web server..

What does PHP GD do?

GD is an open source code library for the dynamic creation of images. GD is used for creating PNG, JPEG and GIF images and is commonly used to generate charts, graphics, thumbnails on the fly.

Which function should be run to watch that GD Support is enabled or not?

To know this we can use phpinfo function and check GD support is available or not.

Chủ Đề