PHP其實滿久才更新一次的,這次的5.3.9是因為安全性的修正(Hash計算引起的DDoS攻擊),詳細可以參考官網的更新紀錄,但對手動鞭譯的人還滿討厭的,因為都已經上線運作了還得暫停來搞,我的想法是儘速更新完就好了,畢竟買便宜的VPS沒太多資源搞雙機運作還啥的方案,乾脆早死早超生~ 趕快弄一弄就好了。 :er
*********更新歷史*********
2012/06/14 – 升級5.3.13
2012/07/01 – 升級5.3.14
Step.1:停止相關服務來下載新版PHP安裝並備份原設定檔
/etc/init.d/mysql stop
/etc/init.d/nginx stop
/etc/init.d/php-fpm stop
cp /usr/local/php/etc/php.ini /usr/local/php.ini.bak
cp /usr/local/php/etc/php-fpm.conf /usr/local/php-fpm.conf.bak
cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/imagick.so /usr/src/
cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/memcache.so /usr/src/
cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/pdo_mysql.so /usr/src/
rm -rf /usr/local/php
cd /usr/src/
wget http://us2.php.net/distributions/php-5.3.14.tar.bz2
tar jxf php-*.tar.bz2
cd php-*
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-bcmath --enable-calendar --enable-dba --enable-exif --enable-fpm --enable-ftp --enable-gd-jis-conv --enable-gd-native-ttf --enable-inline-optimization --enable-mbstring --enable-mbregex --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sqlite-utf8 --enable-sysvmsg --enable-sysvshm --enable-sysvsem --enable-xml --enable-wddx --enable-zip --with-bz2 --with-curl --with-curlwrappers --with-freetype-dir --with-fpm-user=www --with-fpm-group=www --with-gd --with-gettext --with-iconv-dir=/usr/local/libiconv --with-jpeg-dir --with-libxml-dir --with-mcrypt --with-mhash --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-png-dir --with-openssl --with-t1lib=/usr/share/t1lib --with-xmlrpc --with-xpm-dir --with-xsl --with-zlib
make && make install
/usr/local/php/lib/php/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin
cd ..
Step.2:安裝eAccelerator
如果更新完就執行的話一定會碰到如圖片下方Unable to load dynamic library的錯誤訊息,所以要重新安裝相關的PHP外掛模組eAccelerator。
cd /usr/src/
wget http://sourceforge.net/projects/eaccelerator/files/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.tar.bz2
tar jxf eaccelerator-*.tar.bz2
cd eaccelerator-*
/usr/local/php/bin/phpize
./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
make && make install
cd ..
mkdir -p /tmp/eaccelerator_cache
chmod -R 777 /tmp/eaccelerator_cache
cd /usr/src/
rm -fr eaccelerator-*
Step.3:全部搞定,啟動相關服務並刪除殘留檔案,花費時間不到10分鐘 ?
mv -f /usr/local/php.ini.bak /usr/local/php/etc/php.ini
mv -f /usr/local/php-fpm.conf.bak /usr/local/php/etc/php-fpm.conf
mv -f /usr/src/imagick.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
mv -f /usr/src/memcache.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
mv -f /usr/src/pdo_mysql.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/
cd /usr/src/
rm -fr php-*
php -v
/etc/init.d/nginx start
/etc/init.d/php-fpm start
/etc/init.d/mysql start
番外篇:
小記憶體的VPS在因為記憶體太小而鞭譯不過的時候可以換成用這段鞭鞭
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-bcmath --enable-calendar --enable-dba --enable-exif --enable-fpm --enable-ftp --enable-gd-jis-conv --enable-gd-native-ttf --enable-inline-optimization --enable-mbstring --enable-mbregex --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sqlite-utf8 --enable-sysvmsg --enable-sysvshm --enable-sysvsem --enable-xml --enable-wddx --enable-zip --with-bz2 --with-curl --with-curlwrappers --with-freetype-dir --with-fpm-user=www --with-fpm-group=www --with-gd --with-gettext --with-iconv-dir=/usr/local/libiconv --with-jpeg-dir --with-libxml-dir --with-mcrypt --with-mhash --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-png-dir --with-openssl --with-t1lib=/usr/share/t1lib --with-xmlrpc --with-xpm-dir --with-xsl --with-zlib --disable-fileinfo
您可能會喜歡
一條留言
發佈留言
很抱歉,必須登入網站才能發佈留言。
文章不错,来看看