今天在Fedora 16下重装了下PHP,顺便尝鲜一下5.4,期间涉及到的多数软件我都是选择的最新稳定版。这里要注意的就是PHP的一个编译参数:--with-gd=shared ,这里切不可把shared替换为gd2的安装目录/usr/local/gd2,不然会无法编译通过,网上查了下好像是PHP5.3-5.4的一个bug。
yum install -y gcc g-c++ gcc-c++ libtool openssl-devel pam-devel Python-devel libxml2-devel
sourcepath="/opt/source/"
cd {$sourcepath}
wget
mkdir /usr/local/zlib
tar zxvf zlib-1.2.6.tar.gz
cd zlib-1.2.6
./configure --prefix=/usr/local/zlib
make && make install
echo "/usr/local/zlib/lib" >> /etc/ld.so.conf
ldconfig
chcon -t textrel_shlib_t /usr/local/zlib/lib/libz.so*
cd {$sourcepath}
wget
tar zxvf libxml2-2.7.8.tar.gz
cd libxml2-2.7.8
./configure --prefix=/usr/local/libxml2 --with-python
make
make install
LD_LIBRARY_PATH=/usr/local/lib
LD_LIBRARY_PATH=/usr/local/libxml2/lib
LD_LIBRARY_PATH=/usr/lib/python2.7/site-packages
echo "/usr/local/libxml2/lib" >> /etc/ld.so.conf
echo "/usr/lib/python2.7/site-packages" >> /etc/ld.so.conf
ldconfig
cd {$sourcepath}
wget
mkdir /usr/local/libxslt
tar zxvf libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2
make
make install
echo "/usr/local/libxslt/lib" >> /etc/ld.so.conf
echo "/usr/local/libxslt/lib/python2.7/site-packages" >> /etc/ld.so.conf
ldconfig
cd {$sourcepath}
wget
mkdir /usr/local/libiconv
tar zxvf libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr/local/libiconv
make
make install
echo "/usr/local/libiconv/lib" >> /etc/ld.so.conf
ldconfig
cd {$sourcepath}
wget
tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9
./configure
make
make install
echo "/usr/local/lib" >> /etc/ld.so.conf
ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
ldconfig
cd {$sourcepath}
wget
mkdir /usr/local/libmcrypt
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/libltdl
./configure --enable-ltdl-install
make
make install
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
cd {$sourcepath}
cd libmcrypt-2.5.8
./configure --prefix=/usr/local/libmcrypt
make && make install
ln -s /usr/local/libmcrypt/lib/libmcrypt.la /usr/lib/libmcrypt.la
ln -s /usr/local/libmcrypt/lib/libmcrypt.so /usr/lib/libmcrypt.so
ln -s /usr/local/libmcrypt/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
ln -s /usr/local/libmcrypt/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
cp /usr/local/libmcrypt/bin/libmcrypt-config /usr/bin/libmcrypt-config
cp /usr/local/libmcrypt/lib/libmcrypt.* /usr/lib
echo "/usr/local/libmcrypt/lib" >> /etc/ld.so.conf
ldconfig
cd {$sourcepath}
wget
mkdir /usr/local/mcrypt
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
LD_LIBRARY_PATH=/usr/local/lib
./configure --prefix=/usr/local/mcrypt --with-libmcrypt-prefix=/usr/local/libmcrypt --with-libiconv-prefix=/usr/local/libiconv
make && make install
cd {$sourcepath}
wget
tar zxvf curl-7.25.0.tar.gz
cd curl-7.25.0
./configure
make && make install
ldconfig
cd {$sourcepath}
wget
mkdir /usr/local/freetype2
tar zxvf freetype-2.4.9.tar.gz
cd freetype-2.4.9
./configure --prefix=/usr/local/freetype2
make && make install
echo "/usr/local/freetype2/lib" >> /etc/ld.so.conf
ldconfig
cd {$sourcepath}
wget
mkdir /usr/local/fontconfig
tar zxvf fontconfig-2.9.0.tar.gz
cd fontconfig-2.9.0
export PKG_CONFIG_PATH=/usr/local/libxml2/lib/pkgconfig:$PKG_CONFIG_PATH
cp -r /usr/local/libxml2/include/libxml2/libxml/ /usr/include/
./configure --prefix=/usr/local/fontconfig --with-freetype-config=/usr/local/freetype2/bin/freetype-config
make && make install
echo "/usr/local/fontconfig/lib" >> /etc/ld.so.conf
ldconfig
cd {$sourcepath}
wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.5.9.tar.gz
mkdir /usr/local/libpng2
tar zxvf libpng-1.5.9.tar.gz
cd libpng-1.5.9/
export LDFLAGS=-L/usr/local/zlib/lib
export CFLAGS=-I/usr/local/zlib/include
./configure --prefix=/usr/local/libpng2
make && make install
echo "/usr/local/libpng2/lib" >> /etc/ld.so.conf
ldconfig