Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"call to undefined function imagecreatetruecolor" error in PHP & pChart

Tags:

php

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. The suggestion solution was to load this dll "php_gd2.dll" so I have uncommented extension=php_gd2.dll in php.ini file.

Even after that I get the same error. I have tried restarting the server & machine too.

like image 420
karthik Avatar asked Dec 30 '10 08:12

karthik


1 Answers

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:

  1. phpinfo() and look up php.ini path
  2. edit php.ini: extension_dir=<path to your extensions>
  3. edit php.ini: extension=php_gd2.dll //uncomment or add
  4. Restart web server
  5. Run the test script again
like image 107
St.Woland Avatar answered Oct 06 '22 00:10

St.Woland