在 CentOS/RHEL 7.1, 6.7 and 5.11 版本上用yum安装 PHP 5.4
在CentOS 7下(包含安装EPEL)
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-7.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7*.rpm epel-release-7*.rpm
如果您原本就已经装过EPEL则执行下面命令:
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm rpm -Uvh remi-release-7*.rpm
在CentOS 6下(包含安装EPEL)
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
如果您原本就已经装过EPEL则执行下面命令:
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6*.rpm
启动程序库(Repo,repository)
vi /etc/yum.repos.d/remi.repo
我们需要确认第一阶段[remi]
是启用状态。
[remi] name=Les RPM de remi pour Enterprise Linux 6 - $basearch #baseurl=http://rpms.famillecollet.com/enterprise/6/remi/$basearch/ mirrorlist=http://rpms.famillecollet.com/enterprise/6/remi/mirror enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
这一行enabled=1
确认要设定!
Installing PHP
输入以操作安装 php
sudo yum install php php-gd php-mysql php-ZendFramework
php-gd php-mysql php-ZendFramework 是额外的不需要可以不装
rpm -qa |grep php
以上命令可以查安装了php相关的什么套件
参照:专题文章:如何在CentOS 6和CentOS 7上安装PHP 5.4、5.5或5.6版本
原文:大专栏 在 CentOS/RHEL 7.1, 6.7 and 5.11 版本上用yum安装 PHP 5.4