« MySQL Start Script | Main | Hard Disk Problem »
February 15, 2006
Add GD Support for PHP
To enable image (JPEG/PNG) manipulation for PHP, install gd extension from ports:
# cd /usr/ports/graphics/php4-gd
# make install clean
# apachectl graceful
If a PHP script needs gd module but can't find it, it will display the following error:
Fatal error: Call to undefined function: imagecreatefromjpeg()
P.S. A simple problem could be troublesome for newbies if they can't find the right web pages. When searching the solution to the above error, a FreeBSD user may be led to a Linux page which states that PHP must be recompiled with gd support. But this is not applicable for FreeBSD system. Hopefully, after I blog this problem, Google will lead them to this post, so that they can enable gd support for PHP within minutes without touching the main PHP installation.
Category : PHP
Posted by FreeBSD Newbie at February 15, 2006 10:53 PM
Comments
This didnt work for me
Posted by at February 21, 2006 06:55 AM
This didnt work for me
Posted by test at March 1, 2006 03:17 PM
You need to rebuild php with the correct switch
Posted by at March 9, 2006 09:35 PM
That's strange...I specially tested it on a second server, the only thing I did is installing gd extension.
Posted by FreeBSD Newbie at March 10, 2006 05:22 AM
Yah... this did not work for me either... just tried to install it from ports... installs fine, just doesn't show up in phpinfo() ...
Posted by Marc at March 20, 2006 02:42 AM
Helpful, as I was trying to solve a similar problem: install MySQL support for PHP, not GD.
Posted by at April 10, 2006 10:17 AM
Hey, this worked perfectly for me. The only difference is I used pkg_add -r php4-gd.
I'm running 6.0 RELEASE, and I needed it for a drupal install. Worked perfectly as documented above. Make sure you don't forget to HUP apache, though! Drupal didn't pick up gd until I did the "apachectl graceful" step. After that - sweet as.
Cheer
Bill G.
Posted by bsd-n00b at April 29, 2006 02:59 AM
Worked very well for me with only a few minor differences. I'm using PHP5, so I replaced your first line with this:
# cd /usr/ports/graphics/php4-gd
As far as re-compilation of php goes, i'm uncertain of it's prior status. I was never getting the error that you show in the example, but i was installing it to enable captcha in Gallery2, so Gallery tested for the GD support before I'd even hit that error.
Thank you.
Posted by Ben at March 1, 2008 10:55 PM
