Thread: PHP GD Library
View Single Post
  #6 (permalink)  
Old 07-22-2009, 05:05 PM
Spiral's Avatar
Spiral Spiral is offline
Registered User
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,501
Spiral is on a distinguished road
Thumbs up

And there is another way ...

If you want GD to really work 100% ...

Compile PHP manually!

(Actually there is reason for this if you are wanting full GD and have all the functions and components actually work correctly)

Open a phpinfo() screen to get your current ./configure options as you'll need the rest of your options later below as !!!OPTIONS!!!

Code:
# yum install coreutils make gcc* glib* libexif libjpeg* libpng* giflib* gd gd-* netpbm Image* freetype*
# /scripts/checkperlmodules    (might want to do this 2 or three times)
At this point you should have an updated compile environment along with the main libraries you will need to build a good GD environment.

Code:
# cd /usr/local/src
# wget http://us3.php.net/get/php-5.2.10.tar.bz2/from/us2.php.net/mirror
# tar jxvf ./php-5.2.10.tar.bz2
# cd php-5.2.10
# ./configure --with-zlib --with-zlib-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr --enable-gd-native-ttf --with-ttf --with-exif --with-gd --with-imagick  !!!YOUR OTHER OPTIONS!!!

(Note the order of the options I've shown --- That is important!)

# make
# make test
# make install
Depending on whether you are using DSO or SuPHP based PHP per the rest of your configure options taken from your current PHP installation, you may or may not need to go update httpd.conf or /opt/suphp/etc/suphp.conf.

Restart your apache server
Code:
service httpd restart
You should now have a well working GD2 system if all went well.

The pre-requisite yum installer I gave you also asked to install ImageMagick which is another very powerful graphics package that a lot of PHP scripts like to use. There is an optional module you can add to PHP to give you direct ImageMagick functions from within PHP.

Code:
# cd /usr/local/src/php-5.2.10/ext
# wget http://pecl.php.net/get/imagick-2.3.0RC2.tgz
# tar zxvf ./imagick-2.3.0RC2.tgz
# mv imagick-2.3.0 imagick
# cd imagick
# phpize
# ./configure 
# make
# make test
# make install
You should now have a line in your /usr/local/lib/php.ini file to load the extension that looks like the following:

Code:
extension=imagick.so
Alternatively you could do everything up to the "phpize" command above after you unpacked your original php-5.2.10.tar.bz2 archive but before you compiled PHP and then added "--with-imagick" to the end of the original GD configure options when you compiled PHP and you will have the optional ImageMagick support (imagick) add-on module hard compiled directly into PHP itself instead of being loaded as an external extension module.
Reply With Quote