預設情況下,CentOS6 64 bit 已經早已不支援php5.2.x ,但是某些php程式還需要zend optimizer支援,怎麼辦呢?目前大部分的yum repos 都已經不支援直接安裝php5.2了,怎麼在CentOS6.x/6.5/6.4/6.3/6.2/7.x 64位元安裝php5.2(使用YUM自動安裝)
wget -qq -O - http://www.atomicorp.com/installers/atomic | /bin/bash
備份[ !!! Take php.ini, php.conf and other backups !!! ]
,如果是新安裝的,就忽略此部分。
刪除已經安裝的php包 yum remove php*
安裝 yum install atomic-php52*
做好對映:
ln -s /opt/atomic/atomic-php52/root/usr/bin/php /usr/bin/php ln -s /opt/atomic/atomic-php52/root/usr/bin/php-cgi /usr/bin/php-cgi ln -s /opt/atomic/atomic-php52/root/etc/php.d/ /etc/php.d ln -s /opt/atomic/atomic-php52/root/etc/php.ini /etc/php.ini ln -s /opt/atomic/atomic-php52/root/usr/lib64/php/ /usr/lib64/php ln -s /opt/atomic/atomic-php52/root/usr/share/php/ /usr/share/php vi /etc/httpd/conf.d/atomic-php52-php.conf # Edit prefork part from libphp5.so to libphp52.so: LoadModule php5_module modules/libphp52.so
測試:
# php -v PHP 5.2.17 (cli) (built: May 21 2014 09:58:58) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies # uname -a Linux host819.ctohome.com 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux [[email protected] etc]# cat /etc/redhat-release CentOS release 6.5 (Final)
搞定!!
收尾:
service httpd restart vi /etc/yum.conf
增加 exclude=php* 防止不小心升級了php
在安裝zend optimizer即可:
This program makes use of the Zend Scripting Language Engine: Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies
如果你需要我們幫您安裝php5.2 + Zend Optimizer ,費用是100元/伺服器/次安裝
centos5.x 32bit 預設安裝是php5.1.x 版本, 要升級到php5.2可嘗試如下方法:
cd /tmp; rpm -ivh http://software.virtualmin.com/bleed/centos/5/i386/virtualmin-bleed-release-1.0-1.rhel.noarch.rpm rm -f php*
vi /etc/yum.conf 增加下面一行禁止升級php5.3
exclude=php*5.3*
執行下面命令開始升級php,檢查是否顯示的是php5.2的版本
yum update php*
vi /etc/yum.conf 增加下面一行禁止升級php
exclude=php*5.3* php*
centos5.x 32bit安裝php5.2的另一個方法:
rpm -Uvh http://mirror.webtatic.com/yum/centos/5/latest.rpm rm -f php*
vi /etc/yum.conf 增加下面一行禁止升級php5.3
exclude=php*5.3*
執行下面命令開始升級php,檢查是否顯示的是php5.2的版本
yum --enablerepo=webtatic --exclude=php*5.3* update php*
安裝缺失php庫:
yum --enablerepo=webtatic --exclude=php*5.3* install mcrypt mbstring php-mbstring php-mcrypt
升級成功後,
vi /etc/yum.conf 增加下面一行禁止升級php
exclude=php*5.3* php*
以上就是關於CentOS6.x/6.5/6.4/6.3/6.2/7.x 64位元安裝php5.2的方法詳解的詳細內容,更多請關注TW511.COM其它相關文章!