将centos6的php5.3升级为5.6,改变yum源

在阿里云主机上,操作系统是Centos6,php版本是5.3。因为安装Yii2.0的需要,我要升级php为5.4。因为还有5.5和5.6,当然要升到高版本了。我决定升到5.6。

 
首先,按照这里的步骤
 
只有php-fpm没有正确安装,所以无法启动之。下面试图单独安装。
 
[root@AY14022011465274454aZ ~]#  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 php56w-php-xml php56w-php-xmlrpc php56w-devel.x86_64  php-xml

## 常见错误处理 

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的时候出错了。)


修改centos安装源

分以下步驟進行

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

 

sudo vim /etc/yum.repos.d/remi.repo

 

進去把所有的 enabled 參數都改成 1

yum –enablerepo=remi update php* mysql*  

最後再進行一次升級的動作

yum -y update php*

 

 

這樣就可以啦!

附帶一提,我們可以直接在指令模式中查詢 php 的版本

php -v

 
====================================
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值