Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

gd installed but still give imagecreate() error

php imagecreate fatal error

6:51 pm on Aug 4, 2007 (gmt 0)

New User

10+ Year Member

joined:Feb 1, 2007
votes: 0

Hello friends;

I've build my php 5.2.3 with gd2 (also i installed gd2 libraries)

My php configure command is ( from phpinfo() )

'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql' '--with-curl' '--with-curldir=/usr/bin' '--with-gd2' '--with-mcrypt' '--with-mhash' '--with-pear' '--with-zlib' '--with-zip' '--enable-ftp' '--enable-magic-quotes' '--enable-mbstring' '--with-freetype'

Anybody knows why still gives Call to undefined function imagecreate() fatal error :/


11:04 pm on Aug 4, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:Mar 1, 2003
votes: 4

Ok, first a disclaimer. I can hardly spell 'PHP', let alone advise anyone how to do anything with it. But...

I had exactly the same error message dealing with a CAPTCHA just yesterday and, in the end, despite phpinfo saying all was well with gd2 I had to edit my php.ini file by uncommenting the extension=php_gd2.dll line, and ensuring that the path to the loadable extensions was correct. A quick reboot after that and all worked just fine.

Good luck.

9:58 am on Aug 5, 2007 (gmt 0)

New User

10+ Year Member

joined:Feb 1, 2007
posts: 34
votes: 0

But I'm using Linux, now windows :(

I've rebuild the php with gd2 and freetype again with this ./configure parameters.

'./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql' '--with-curl' '--with-gd' '--with-mcrypt' '--with-mhash' '--with-gettext' '--with-zlib' '--with-openssl' '--with-freetype-dir' '--with-bz2' '--without-iconv' '--with-mime-magic' '--enable-magic-quotes' '--enable-mbstring' '--enable-zip' '--enable-sockets' '--enable-ftp' '--enable-zend-multibyte' '--enable-gd-native-ttf'

And the gd_info() gives (this was the problem at old build, i've build --with-gd2, but it must --with-gd :))

array(12) {
["GD Version"]=>
string(27) "bundled (2.0.34 compatible)"
["FreeType Support"]=>
["FreeType Linkage"]=>
string(13) "with freetype"
["T1Lib Support"]=>
["GIF Read Support"]=>
["GIF Create Support"]=>
["JPG Support"]=>
["PNG Support"]=>
["WBMP Support"]=>
["XPM Support"]=>
["XBM Support"]=>
["JIS-mapped Japanese Font Support"]=>

But there's still error with "["JPG Support"]=> bool(false)". Now i can use imagecreate becase gd built, but i cant use ImageCreateFromJpeg becase JPG Support not enabled.

I've searched on the web, and i found that libjpeg library must be installed and php must built with "--with-jpeg-dir[=jpg_lib_dir]" configure parameter. I installed libjpeg library, but php can't find libjpeg.so or libjpeg.a

And i found the problem at last :)

I build libjpeg with ./configure --enable-shared --enable-static

Now php can see libjpeg files, and everything is ok.

Maybe this solution will be help someone another day.

Thanks for reading.