2

Fatal error: Uncaught Error: Call to undefined function ImageCreate() in C:\xampp\htdocs\the_base\qr\libs\phpqrcode\qrimage.php:74 Stack trace: #0 C:\xampp\htdocs\the_base\qr\libs\phpqrcode\qrimage.php(32): QRimage::image(Array, 5, 4) #1 C:\xampp\htdocs\the_base\qr\libs\phpqrcode\qrencode.php(494): QRimage::png(Array, 'temp/184011_inf...', 5, 4, false) #2 C:\xampp\htdocs\the_base\qr\libs\phpqrcode\qrencode.php(286): QRencode->encodePNG('\tRoll no: 18401...', 'temp/184011_inf...', false) #3 C:\xampp\htdocs\the_base\qr\index.php(57): QRcode::png('\tRoll no: 18401...', 'temp/184011_inf...', 0, 5) #4 {main} thrown in C:\xampp\htdocs\the_base\qr\libs\phpqrcode\qrimage.php on line 74

This is the error I am getting since I've updated my XAMPP. This same code has worked perfectly with an older version of xampp but when I updated it, the code suddenly started to give this error I am trying to create a QR code in png format and make it downloadable I did a little research about it, it said that the GD lib was missing in the PHP but all the steps shown to fix it were of LINUX OS, I am currently using Windows.

3 Answers 3

3
  1. go to php.ini file xampp/php/php.ini
  2. search for ;extension=gd and ;extension=gd2
  3. remove the ; from both lines, then restart the server
2
  • I couldn't find the ;extension=gd2 line in the file but uncommenting only the ;extension=gd line made it work. Commented Jun 30, 2021 at 12:47
  • Life saver. Kudos! Commented Jun 1, 2022 at 8:24
1

there might be two cases: 1.gd installed and disabled 2. gd not installed and disabled

for first case: on XAMPP server click on Apache config -> php.ini 1.open this file in notepad
2. search for ;extension=gd or ;extension=gd2 3. remove the colon ; ( just extension=gd) 4. save it .

for second case gd not installed: check it through: (on browser) localhost/dashboard xampp dashboard opens up, on upper left go to phpinfo() search for gd section if not present then follow down: 1.open folder : xampp/php/ext 2. then find and Copy php_gd.dll and paste it into the following folder 3.C:\Windows\System32 4. paste php_gd.dll here. 5. restart xampp server and run.

for better explanation: https://www.geeksforgeeks.org/how-to-install-php-gd-in-windows/

0

It seems like the php_gd2 extension isn't enabled.

you have to enable it in php.ini. To do this, simply open php.ini and uncomment (remove the leading ;) the following line:

extension=php_gd2.dll
1
  • 1
    I couldn't find extension=php_gd2.dll in the php.ini, but uncommenting extension=gd worked like a charm Commented Jun 30, 2021 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.