I am trying to integrate \"pChart\" with my PHP code. When I am trying to run the samples it gives me an error stating call to undefined function imagecreatetruecolor<
For PHP 7.2
sudo apt-get install php7.2-gd
I met this problem just now.
You should exec sudo apt install php7.0-gd
or vim your php.ini
reopen extension=php_gd2.dll
This answer is an update 9 years later, but PHP has changed a lot. Please upvote the St. Woland from which this is derived...
Use the following code on your web server to test if you have GD extension:
<?php
$testGD = get_extension_funcs("gd"); // Grab function list
if (!$testGD){
echo "GD not even installed.";
phpinfo(); // Display the php configuration for the web server
exit;
}
echo"<pre>".print_r($testGD,true)."</pre>"; //display GD function list
If you get the message that it's not installed, then check the following steps:
php.ini
and enable the GD extension:
sudo apt install php7.3-gd
# replace version to yoursAs you can see the exact method is very version dependent. I hope this additional information can help others sort out the exact steps they might need.
In Ubuntu/Linux Mint Platform (under root), use the following command:
apt-get update && apt-get -y install php5-gd
Use the following code to test if you have GD extension:
<?php
$testGD = get_extension_funcs("gd"); // Grab function list
if (!$testGD){ echo "GD not even installed."; exit; }
echo"<pre>".print_r($testGD,true)."</pre>";
If you get the message that it's not installed, then check the following steps:
phpinfo()
and look up php.ini pathphp.ini
: extension_dir=<path to your extensions>php.ini
: extension=php_gd2.dll //uncomment or addI have same error:
PHP Fatal error: Call to undefined function imagecreatetruecolor() in /var/www/webphp/php/captcha.php on line 251
and my solution was this:
$ locate php.ini
/etc/php56/php.ini
edit file php.ini and uncomment line content "extension=gd.so", save and try again