0

I am getting following error while generating qrcode in php.

Error:

Fatal error: Uncaught Error: Call to undefined function ImageCreate()

Fatal error: Uncaught Error: Call to undefined function ImageCreate() in E:\files\includes\phpqrcode\qrimage.php:74 
Stack trace:
#0 E:\files\includes\phpqrcode\qrimage.php(32): QRimage::image(Array, 5, 4)
#1 E:\files\includes\phpqrcode\qrencode.php(494): QRimage::png(Array, false, 5, 4, false)
#2 E:\files\includes\phpqrcode\qrencode.php(286): QRencode->encodePNG('eyJhbGciOiJSUzI...', false, false)
#3 E:\files\generate_qr.php(12): QRcode::png('eyJhbGciOiJSUzI...', false, 0, 5, 4, false)
#4 {main}
    thrown in E:\files\includes\phpqrcode\qrimage.php on line 74

.

.

.

I have enebled gd extension by following this question: Fatal error: Call to undefined function: imagecreate()

Following is my php.ini:

extension=php_gd2.dll

But still getting error.

I tried changing php version, tried different php files but still getting error.

I tried running the application as administrator also.

I am using Windows 11.

I tried following code to check if gd extension is enebled.

<?php
if (extension_loaded('gd')) {
    echo "GD library is enabled.";
} else {
    echo "GD library is not enabled.";
}
?>

It returns: GD library is not enabled..

Why is gd extension is not being enebled?

. . In phpinfo(); it shows this:

GD imaging: Rasmus Lerdorf, Stig Bakken, Jim Winstead, Jouni Ahto, Ilia Alshanetsky, Pierre-Alain Joye, Marcus Boerger

Hello World
  • 2,673
  • 7
  • 28
  • 60

1 Answers1

0

In the phpinfo output, you are looking at the CREDITS and not at the section that actually reports the extensions that are active.

These are the Credits enter image description here

And this is the section you would see if the GD extension was active

enter image description here

I would guess that you have more than one php.ini file and the one you are checking/editing to activate the GD extension is not the one your system is actually using.

Look at the TOP SECTION of the phpinfo output, it will tell you which file is being read as PHP.INI

enter image description here

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149