skip to Main Content

Fatal error: Uncaught Error: Call to undefined function ImageCreate() in C:xampphtdocsthe_baseqrlibsphpqrcodeqrimage.php:74 Stack trace: #0 C:xampphtdocsthe_baseqrlibsphpqrcodeqrimage.php(32): QRimage::image(Array, 5, 4) #1 C:xampphtdocsthe_baseqrlibsphpqrcodeqrencode.php(494): QRimage::png(Array, 'temp/184011_inf...', 5, 4, false) #2 C:xampphtdocsthe_baseqrlibsphpqrcodeqrencode.php(286): QRencode->encodePNG('tRoll no: 18401...', 'temp/184011_inf...', false) #3 C:xampphtdocsthe_baseqrindex.php(57): QRcode::png('tRoll no: 18401...', 'temp/184011_inf...', 0, 5) #4 {main} thrown in C:xampphtdocsthe_baseqrlibsphpqrcodeqrimage.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


  1. 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
    
    Login or Signup to reply.
    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
    Login or Signup to reply.
  2. 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:WindowsSystem32
    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/

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search