I'm trying to save a png image, and when I run the error script:
Fatal error: Uncaught Error: Call to undefined function imagecreatefrompng()
But from what I've seen, this function is native to PHP:
I'm trying to save a png image, and when I run the error script:
Fatal error: Uncaught Error: Call to undefined function imagecreatefrompng()
But from what I've seen, this function is native to PHP:
This function is part of the php-gd
library.
You need to install it on your machine to make use of it.
yum install php-gd # CentOS
apt-get install php7-gd # Ubuntu
With the help of lazyFox and bfavaretto I found the problem:
I took a look at my info.php
that I created and put it in the root folder:
<?php
phpinfo();
?>
And I checked the GD library and it really was disabled.
What I did was in Windows, in Linux I added below:
I entered my php.ini
and edited the line containing the extension GD2:
Afterthisrestarttheserver(Apache,NGinx,php-S)
OnLinux,justinstallthelibrarywiththedependencymanager:
yuminstallphp-gd#CentOSapt-getinstallphp7-gd#Ubuntu
Afterthisrestarttheservice(Apache,NGinx,php-S)
Thenjusttocheck,Iwentbacktoinfo.phpanditwasreallyactivatedandmyfunctionworked: