默认情况下,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 !!! ],如果是新安装的,就忽略此部分。
安装 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
[root@host819 etc]# cat /etc/redhat-release
CentOS release 6.5 (Final)
搞定!!
收尾:
service httpd restart
vi /etc/yum.conf
在安装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
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
升级成功后,
原文链接:/centos/882463.html