將centos6的php5.3升級為5.6,改變yum源
阿新 • • 發佈:2018-12-26
在阿里雲主機上,作業系統是Centos6,php版本是5.3。因為安裝Yii2.0的需要,我要升級php為5.4。因為還有5.5和5.6,當然要升到高版本了。我決定升到5.6。
首先,按照這裡的步驟 只有php-fpm沒有正確安裝,所以無法啟動之。下面試圖單獨安裝。 [[email protected] ~]# 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分以下步驟進行
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
====================================