Install necessary software by yum or from source
yum install gd gd-devel yum install zlib zlib-devel
then
a) Download the php source from here : http://www.php.net/downloads.php
b) Download the source file in to /tmp directory
c) Here I am gussing the php version is php-5.3.0.tar.gz
d) Tar –xvzf php-5.3.0.tar.gz
e) Cd php-5.3.0
f)
./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --enable-mbstring –-with-gd –-with-zlib –-with-jpeg-dir –-with-png-dir
g) make
h) make install
i) setup your php.ini : cp php.ini-dist /usr/local/lib/php.ini
j) Stop apache /usr/local/apache/bin/apachectl1 stop
k) Restart apache /usr/local/apache/bin/apachectl1 start
How to check :
create a file phpinfo.php
<?php
phpinfo();
?>
Open the file in your browser , http://localhost/phpinfo.php
and Look for 2 section , GD and ZLIB. You should see something like bellow pictures
Tags: gd library and php compilation, gd library and php source installation, How to compile gd library in php, Linux:How to add gd library in php