服務器環境: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 install cp php.ini-production /usr/local/webserver/php-d/php-5.5.0/etc/php.ini
這裏有幾個地方需要說明一下:
安裝時,請根據自己的情況添加、刪除附加組建,修改對應的目錄路徑
安裝的時候別忘記了搭配opcache:–enable-opcache
php-5.3.10編譯時加了–enable-safe-mode選項,但是php-5.4.0已經去掉了該選項,編譯時可以 ./configure –help | grep “safe-mode” 查看一下,沒有信息輸出,表示已經不支持!
同樣去處的還有:’–enable-discard-path’,’–enable-fastcgi’,’–enable-force-cgi-redirect’,’–with-curlwrappers’