Fatal error: Call to undefined function imagecreatefromjpeg(

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lostinfog
Forum Newbie
Posts: 8
Joined: Wed Apr 26, 2006 4:22 am

Fatal error: Call to undefined function imagecreatefromjpeg(

Post by lostinfog »

My environment: Apache 2.0.55, PHP 5.1.2 Windows XP
I've changed my php.ini, removed the ; before extension=php_gd2.dll. Also php_gd2.dll can be found in php/ext/ dir.
I've checked the phpinfo() output. Only one line about gd, "Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"".
What's the error cause?
Thanks in advance!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

forget to restart apache?
lostinfog
Forum Newbie
Posts: 8
Joined: Wed Apr 26, 2006 4:22 am

Post by lostinfog »

Restart Apache several times. The error remains. :(
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Is extension_dir set correctly in php.ini? I should look something like:

extension_dir = "c:/my/path/to/php-5.1.2-Win32/ext/"

If the extension is loaded it will show up as its own section in phpinfo().
(#10850)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Are you 100% sure you've edited the right php.ini file? The ini php loaded is listed near the top of phpinfo().

When running phpinfo(), if you don't see an entire section about GD its extension isn't loaded.
lostinfog
Forum Newbie
Posts: 8
Joined: Wed Apr 26, 2006 4:22 am

Fix it!

Post by lostinfog »

Many thanks!
You're right. I modified the extension_dir in php.ini and it works.
Some time ago, I uncommented line "extension=php_mysql.dll", then mysql support is ok. Since mysql extension can work without correct extension_dir setting, why gd cannot? It's a bit confusing. That's also why I didn't check the extension_dir setting.
Post Reply