When I try to use following script on my own webserver running with apache2, php5 and GD.
Code:
<?php
header("Content-type: image/png");
$im = @imagecreate(100, 50)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>
When I run the script it outputs
Code:
Fatal error: Call to undefined function: imagecreatefromgd2() in /var/www/iipee.php on line 2
And this is what my php info GD-part looks like
Code:
gd
GD Support => enabled
GD Version => 2.0 or higher
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.2.1
T1Lib Support => enabled
GIF Read Support => enabled
GIF Create Support => enabled
JPG Support => enabled
PNG Support => enabled
WBMP Support => enabled
When i try to run script without headers it outputs same error as before.
when i run your script, it works fine. there's probably something wrong with your gd configuration
here's mine:
Code:
GD Support => enabled
GD Version => bundled (2.0.28 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
GIF Read Support => enabled
GIF Create Support => enabled
JPG Support => enabled
PNG Support => enabled
WBMP Support => enabled
XBM Support => enabled
If you installed a compiled binary version of PHP, GD support is enabled, you do not need to do anything to get GD to work. If you did try to install a version of GD from elsewhere, I am with UnrealEd, your configuration now has a problem.
The PHP manual states that the imagecreatefromgd2() function requires GD 2.0.1 or later. Your configuration listing says 2.0 or higher. You could have 2.0.0, in which case the error message would be expected. The latest GD version bundled with PHP 5.1.4 is - 2.0.28
The function call in the error message is not the same function name in the code you posted (it is possible the function you are using makes use of the other internally, but PHP is usually very good about giving on target error messages.)
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
If you installed a compiled binary version of PHP, GD support is enabled, you do not need to do anything to get GD to work. If you did try to install a version of GD from elsewhere, I am with UnrealEd, your configuration now has a problem.
The PHP manual states that the imagecreatefromgd2() function requires GD 2.0.1 or later. Your configuration listing says 2.0 or higher. You could have 2.0.0, in which case the error message would be expected. The latest GD version bundled with PHP 5.1.4 is - 2.0.28
The function call in the error message is not the same function name in the code you posted (it is possible the function you are using makes use of the other internally, but PHP is usually very good about giving on target error messages.)
I have Debian and I installed gd using apt
Where can I find all the configuration files related to GD and PHP gd configuration files?
The only configuration file change is that php.ini must load the GD module, which it apparently is because of the entries listed in your phpinfo output. Other than that, there is nothing to configure.
What we both said was something is wrong with your configuration. From the latest PHP documentation, "there is no official Debian packages of PHP 5." http://us3.php.net/manual/en/install.unix.debian.php I suspect that the version of GD that you found and installed is not new enough to support the function you are using or it is not compatible with the PHP version or the operating system.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???