centos下用yum安装php5.4

创建时间:2015-01-16 13:51:28最后修改:2015-01-16 13:56:22

centos下用yum安装的php默认版本一般是PHP5.3,如果想要在Centos下用yum安装5.4的话就需要另外安装yum的源,根据centos版本的不同,选择以下源进行安装:

CentOS/RHEL 7.x:

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
CentOS/RHEL 6.x:
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
CentOS/RHEL 5.x:
rpm -Uvh https://mirror.webtatic.com/yum/el5/latest.rpm

添加完yum源之后就可以直接使用yum命令安装php5.4了:

yum install php54w
安装PHP5.4的memcache和redis扩展:
yum install php54w-pecl-memcache php54w-pecl-redis

安装PHP5.4的其它常用扩展:

yum -y install php54w-curl php54w-gd* php54w-pdo* php54w-xmlrpc php54w-xml php54w-mcrypt php54w-fpm php54w-cli php54w-cgi php54w-pear* php54w-mbstring php54w-mysql php54w-devel php54w-pecl-apc php54w-pecl-zendopcache php54w-pecl-memcache php54w-pecl-redis