imagecreatefrompng() function does not exist - Undefined Function error

Asked

Viewed 1,875 times

1

  • 1

    This function is part of the GD library, it should not be installed. Check your php info.

2 answers

1

This function is part of the library php-gd.
You need to install it on your machine to make use of it.

yum install php-gd # CentOS

apt-get install php7-gd # Ubuntu
  • I’m using windows at the moment, where do I see it?

  • Try editing the php.ini file and looking for something like ;extension=php_gd2 if it exists it removes the ; and restarts the apache

1

With the help of lazyFox and bfavaretto I found the problem:

I took a look at my info.php that I created and put in the root folder:

<?php
    phpinfo();
?>

And I consulted through the GD library and it really was disabled.

What I did was on Windows, on Linux I added below:


IN WINDOWS

I got into my php.ini and edited the line containing the GD2 extension:

inserir a descrição da imagem aqui

After this restart the server (Apache, Nginx, php -S)


LINUX

On Linux just install the library with the dependency manager:

yum install php-gd # CentOS

apt-get install php7-gd # Ubuntu

After this restart the service (Apache, Nginx, php -S)


Then just to check, I entered again in info.php and really was enabled and worked my function:

inserir a descrição da imagem aqui

  • the ones you put in? only that command already downloads the extension and configures php.ini in linux?

  • Yes, just re-start the apache service.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.