Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
393 views
in Technique[技术] by (71.8m points)

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

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.

question from:https://stackoverflow.com/questions/4560996/call-to-undefined-function-imagecreatetruecolor-error-in-php-pchart

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...