日期:2014-05-17  浏览次数:20534 次

fedora16下PHP5.4编译安装笔记
今天重装了下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 http://fossies.org/unix/misc/zlib-1.2.6.tar.gz
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 http://xmlsoft.org/sources/libxml2-2.7.8.tar.gz
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 http://xmlsoft.org/sources/libxslt-1.1.26.tar.gz
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 http://vps.googlecode.com/files/libiconv-1.13.1.tar.gz
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 http://vps.googlecode.com/files/mhash-0.9.9.9.tar.gz
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 http://vps.googlecode.com/files/libmcrypt-2.5.8.tar.gz
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 http://vps.googlecode.com/files/mcrypt-2.6.8.tar.gz
mkdir /usr/local/mcrypt
tar zxvf mcrypt-2.6.8.tar.gz
cd mcrypt-2.6.8
LD_LIBRARY_