4.9.09

:: build php on centos

:: what is
please take a look at this.

:: case
we can build php with support mysql, apache, gd, jpeg, png, freetype, curl, zlib, mcrypt, mbstring, ftp.

:: compile and install dependency for php support
- apache
- mysql
- gd
[ compile and installing libpng ]
[ root:~ ]# vi /etc/ld.so.conf
# add this line
/usr/local/lib
[ root:~ ]# mkdir download
[ root:~ ]# cd download/
[ root:downlad ]# wget http://sourceforge.net/projects/libpng/files/01-libpng-master/1.2.40rc01/libpng-1.2.40rc01.tar.bz2/download
[ root:downlad ]# tar -xjf libpng-1.2.40rc01.tar.bz2
[ root:downlad ]# cd libpng-1.2.39
[ root:libpng-1.2.39 ]# ./configure
[ root:libpng-1.2.39 ]# make && make install

[ compile and install libjpeg ]
[ root:downlad ]# wget http://sourceforge.net/projects/libjpeg/files/libjpeg/6b/jpegsrc.v6b.tar.gz/download
[ root:downlad ]# tar -xzf jpegsrc.v6b.tar.gz
[ root:downlad ]# cd jpeg-6b/
[ root:jpeg-6b ]# ./configure --prefix=/usr/local --enable-shared --enable-static
[ root:jpeg-6b ]# mkdir -p /usr/local/man/man1
[ root:jpeg-6b ]# make && make install
[ root:jpeg-6b ]# ldconfig

[ compile and install libfreetype ]
[ root:downlad ]# wget http://sourceforge.net/projects/freetype/files/freetype2/2.3.9/freetype-2.3.9.tar.bz2/download
[ root:downlad ]# tar -xjf freetype-2.3.9.tar.bz2
[ root:downlad ]# cd freetype-2.3.9
[ root:freetype-2.3.9 ]# ./configure
[ root:freetype-2.3.9 ]# make && make install

[ compile and install libpkg-config ]
[ root:downlad ]# wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.22.tar.gz
[ root:downlad ]# tar -xzf pkg-config-0.22.tar.gz
[ root:downlad ]# cd pkg-config-0.22
[ root:pkg-config-0.22 ]# ./configure --prefix=/usr/local
[ root:pkg-config-0.22 ]# make && make install

[ compile and install libxml2 ]
[ root:downlad ]# wget ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
[ root:downlad ]# tar -xzf libxml2-2.7.6.tar.gz
[ root:downlad ]# cd libxml2-2.7.6
[ root:libxml2-2.7.6 ]# ./configure
[ root:libxml2-2.7.6 ]# make && make install

[ compile and install fontconfig ]
[ root:downlad ]# wget http://fontconfig.org/release/fontconfig-2.4.2.tar.gz
[ root:downlad ]# tar -xzf fontconfig-2.4.2.tar.gz
[ root:downlad ]# cd fontconfig-2.4.2
[ root:fontconfig-2.4.2 ]# ./configure
[ root:fontconfig-2.4.2 ]# make && make install

[ compile and installing gd ]
[ root:downlad ]# wget http://www.libgd.org/releases/gd-2.0.35.tar.gz
[ root:downlad ]# tar -xzf gd-2.0.35.tar.gz
[ root:downlad ]# cd gd-2.0.35
[ root:gd-2.0.35 ]# ./configure --with-png=/usr/local/lib --with-freetype=/usr/local/lib --with-jpeg=/usr/local/lib --with-fontconfig=/usr/local/lib
[ root:gd-2.0.35 ]# ldconfig
[ root:gd-2.0.35 ]# make && make install

- zlib
[ compile and install zlib ]
[ root:downlad ]# wget http://www.zlib.net/zlib-1.2.3.tar.gz
[ root:downlad ]# tar -xzf zlib-1.2.3.tar.gz
[ root:downlad ]# cd zlib-1.2.3/
[ root:zlib-1.2.3 ]# ./configure
[ root:zlib-1.2.3 ]# make && make install

- mcrypt
[ installing libmcrypt ]
[ root:downlad ]# wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.bz2/download
[ root:downlad ]# tar -xzf libmcrypt-2.5.8.tar.gz
[ root:downlad ]# cd libmcrypt-2.5.8
[ root:libmcrypt-2.5.8 ]# ./configure --disable-posix-threads --enable-dynamic-loading
[ root:libmcrypt-2.5.8 ]# make && make install
[ root:libmcrypt-2.5.8 ]# ldconfig
[ root:mhash-0.9.9.9 ]# cd ..

[ installing mhash ]
[ root:downlad ]# wget http://sourceforge.net/projects/mhash/files/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz/download
[ root:downlad ]# tar -xzf mhash-0.9.9.9.tar.gz
[ root:downlad ]# cd mhash-0.9.9.9
[ root:mhash-0.9.9.9 ]# ./configure
[ root:mhash-0.9.9.9 ]# make && make install
[ root:mhash-0.9.9.9 ]# ldconfig
[ root:mhash-0.9.9.9 ]# cd ..

[ installing mcrypt ]
[ root:downlad ]# wget http://sourceforge.net/projects/mcrypt/files/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz/download
[ root:downlad ]# tar -xzf mcrypt-2.6.8.tar.gz
[ root:downlad ]# cd mcrypt-2.6.8
[ root:mcrypt-2.6.8 ]# ./configure
[ root:mcrypt-2.6.8 ]# make && make install
[ root:mcrypt-2.6.8 ]# ldconfig
[ root:mcrypt-2.6.8 ]# cd ..

- curl
[ compile and install curl ]
[ root:downlad ]# wget http://curl.haxx.se/download/curl-7.19.6.tar.gz
[ root:downlad ]# tar -xzf curl-7.19.6.tar.gz
[ root:downlad ]# cd curl-7.19.6
[ root:curl-7.19.6 ]# ./configure
[ root:curl-7.19.6 ]# make && make install

:: compile and install php 5.3.0
[ root:downlad ]# wget http://nl2.php.net/get/php-5.3.0.tar.bz2/from/id.php.net/mirror
[ root:downlad ]# tar -xjf php-5.3.0.tar.bz2
[ root:downlad ]# cd php-5.3.0
[ root:php-5.3.0 ]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-gd=/usr/local --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local --with-zlib-dir=/usr/local --with-mcrypt=/usr/local/bin/mcrypt --with-curl=/usr/local --enable-mbstring --enable-ftp
[ root:php-5.3.0 ]# make && make install
[ root:php-5.3.0 ]# cp php.ini-production /usr/local/etc/php.ini
[ root:php-5.3.0 ]# vi /usr/local/etc/php.ini
; change this line
include_path = ".::/usr/local/lib/php"

:: testing
[ root:php-5.3.0 ]# php -v
PHP 5.3.0 (cli) (built: Sep 4 2009 20:20:54)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2009 Zend Technologies
[ root:php-5.3.0 ]# php -i | grep ^mcrypt
mcrypt
mcrypt support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value
[ root:php-5.3.0 ]# php -i | grep ^gd
gd
gd.jpeg_ignore_warning => 0 => 0

:: links
+ GoogleLinux
+ BlacKonsole