I spent so much time trying to figure this out on Windows after installing PHP Version 8.0.11
.
I created this phpinfo.php
file to check whether GD was loaded:
<?php
if (extension_loaded('gd')) {
print 'gd loaded';
} else {
print 'gd NOT loaded';
}
phpinfo(); ?>
If it returns gd NOT loaded
then ensure that in your php.ini
file you have the following unchecked:
; - Many DLL files are located in the extensions/ (PHP 4) or 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=gd
Further down they'll be a section for extension_dir
on Windows you need to uncheck the following:
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
;extension_dir = "./"
; On windows:
extension_dir = "ext"
You should now see gd loaded
when running the phpinfo.php
file and any function calls (like imagecreatefromjpeg()
) should now work as intended.