日期:2014-05-16  浏览次数:20447 次

编译php5.4及安装后添加扩展

今天因为研发需要php5.4 没有相应的RPM包,所以只能下载源码包编译了

下载php5.4包:wget http://cn2.php.net/get/php-5.4.8.tar.gz/from/this/mirror

tar zxvf php-5.4.8.tar.gz

php模块最好不要在编译的时候安装进去,以免日后升级麻烦,

./configure --prefix=/usr/local/webserver/php \
??????? --with-zlib \
??????? --with-mysql=/data/mysql \
??????? --with-jpeg-dir=/usr/local/jpeg \
??????? --with-png-dir=/usr/local/libpng \
??????? --with-freetype-dir=/usr/local/freetype \
??????? --with-libexpat-dir \
??????? --with-iconv \
??????? --with-ttf \
??????? --with-curl \
??????? --with-curlwrappers \
??? --disable-sqlite \
??????? --enable-gd-native-ttf \
??????? --enable-mbstring \
??????? --enable-sockets \
??????? --enable-fastcgi \
??????? --enable-force-cgi-redirect \
??????? --enable-discard-path \
??????? --enable-safe-mode \
??????? --enable-sysvsem \
??????? --enable-sysvshm \
??????? --enable-sysvmsg \
??????? --enable-inline-optimization \
??????? --disable-xmlreader \
??????? --disable-debug \
??????? --disable-rpath \
??? --disable-libxml \
??? --disable-dom \
??? --disable-pdo \
??? --disable-simplexml \
??? --disable-xml \
??? --disable-xmlwriter \
??????? --without-pear \
??????? --enable-fpm \
??????? --with-fpm-user=nobody \
??????? --with-fpm-group=nobody \
??????? --with-fpm-log=/var/log/php-fpm.log \
??????? --with-fpm-pid=/var/run/php-fpm/php-fpm.pid

途中遇到configure: error: Cannot find libz 解决办法

yum install zlib.x86_64