手记

Linux平滑编译升级php至5.5.0

http://levi.cg.am/?p=2987

服务器环境:CentOS – 5.4

php升级:5.4.14 - 5.5.0

升级心得:比较顺利,但是有一点需要说明:eaccelerator无法兼容php5.5.0,好在php在5.5.0默认提供了Zend OPcache,所以一直习惯eaccelerator的朋友如果要升级到php5.5.0的话,可能要暂时和eaccelerator说bye bye了。

1、安装php5.5.0

下载php安装包:http://www.php.net/get/php-5.5.0.tar.gz/from/a/mirror


# 解压缩安装包tar zxvf php-5.5.0.tar.gz      # 进入目录cd php-5.5.0      # 编译安装./configure \--prefix=/usr/local/webserver/php-d/php-5.5.0 \--with-config-file-path=/usr/local/webserver/php-d/php-5.5.0/etc \--with-config-file-scan-dir=/usr/local/webserver/php-d/php-5.5.0/etc/php.d \--with-curl=/usr/local/lib \--with-freetype-dir=/usr/lib64 \--with-gd \--with-gettext \--with-iconv-dir=/usr/local/lib \--with-jpeg-dir=/usr/lib64 \--with-kerberos \--with-ldap \--with-ldap-sasl \--with-libdir=lib64 \--with-libxml-dir=/usr/lib64 \--with-mcrypt \--with-mhash \--with-mysql \--with-mysqli \--with-openssl \--with-pcre-regex=/usr \--with-pdo-mysql=shared \--with-pdo-sqlite=shared \--with-pear=/usr/local/lib/php \--with-png-dir=/usr/lib64 \--with-xmlrpc \--with-xsl \--with-zlib \--enable-fpm \--enable-bcmath \--enable-libxml \--enable-inline-optimization \--enable-gd-native-ttf \--enable-mbregex \--enable-mbstring \--enable-opcache \--enable-pcntl \--enable-shmop \--enable-soap \--enable-sockets \--enable-sysvsem \--enable-xml \--enable-zip \--disable-rpath      make ZEND_EXTRA_LIBS='liconv'make installcp php.ini-production /usr/local/webserver/php-d/php-5.5.0/etc/php.ini

这里有几个地方需要说明一下:

  1. 安装时,请根据自己的情况添加、删除附加组建,修改对应的目录路径

  2. 安装的时候别忘记了搭配opcache:–enable-opcache

  3. php-5.3.10编译时加了–enable-safe-mode选项,但是php-5.4.0已经去掉了该选项,编译时可以 ./configure –help | grep “safe-mode” 查看一下,没有信息输出,表示已经不支持!

  4. 同样去处的还有:’–enable-discard-path’,’–enable-fastcgi’,’–enable-force-cgi-redirect’,’–with-curlwrappers’


0人推荐
随时随地看视频
慕课网APP