默认情况下,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*
原文地址:https://www.cnblogs.com/ydwzhang/p/12235191.html