阿里云主机centos yum php5.3升级5.6的方法整理
方法一:
首先,按照这里的步骤
https://zhidao.baidu.com/question/1239848546058086499.html
只有php-fpm没有正确安装,所以无法启动之。下面试图单独安装。
# yum install php-fpm
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.aliyun.com
* webtatic: uk.repo.webtatic.com
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package php-fpm.x86_64 0:5.3.3-48.el6_8 will be installed
–> Processing Dependency: php-common(x86-64) = 5.3.3-48.el6_8 for package: php-fpm-5.3.3-48.el6_8.x86_64
–> Running transaction check
—> Package php-common.x86_64 0:5.3.3-48.el6_8 will be installed
–> Processing Conflict: php56w-common-5.6.26-1.w6.x86_64 conflicts php-common < 5.6
–> Finished Dependency Resolution
Error: php56w-common conflicts with php-common
You could try using –skip-broken to work around the problem
You could try running: rpm -Va –nofiles –nodigest
# yum install php56w-fpm
# service php-fpm start
Starting php-fpm: Failed loading /usr/lib64/php/modules/ZendGuardLoader.so: /usr/lib64/php/modules/ZendGuardLoader.so: undefined symbol: zend_get_hash_value
[ OK ]
(这个错误信息是怎么回事?此后一直伴随,好在没有其它影响,先不管它)
============
后续:
1、执行数据库操作时,找不到PDO模块
试着用下面指令
# yum install -y libxml2-devel openssl-devel libcurl-devel libjpeg-devel libpng-devel libicu-devel openldap-devel freetype freetype-devel # –没用
# yum install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64 #–出错
# yum install php56w-pdo #–成功
重启php-fpm服务,这次yii出现新的错误
CDbConnection failed to open the DB connection: could not find driver
# yum install php56w-mysql
重启服务,这次yii不出错了,但渲染一小块内容,确切地说,只渲染action自己的view的那一块东西,layout/main.php的没过来。
# yum install php56w-mbstring
这次渲染正确了。
发现在饭店查询时出现错误:
include(DOMDocument.php): failed to open stream: No such file or directory
# yum install php56w-dom
成功了。(估计是在解析xml的时候出错了。)
方法二:
配置yum源
追加CentOS 6.5的epel及remi源。
# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
以下是CentOS 7.0的源。
# yum install epel-release
# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
使用yum list命令查看可安装的包(Packege)。
# yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
安装PHP5.6
yum源配置好了,下一步就安装PHP5.6。
# yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof
用PHP命令查看版本。
# php --version
PHP 5.6.0 (cli) (built: Sep 3 2014 19:51:31)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
在这里安装的版本是PHP5.6.0,细心的用户可能已经发现ZendGuardLoader变成Zend OPcahe了。
对从PHP5.5开始PHP代码缓存从APC变成了Zend OPcache了。