在centos直接使用yum install 安装php的话版本比较低,如果需要高版本的话,请看如下:
Remi repository 是包含最新版本 PHP 和 MySQL 包的 Linux 源,由 Remi 提供维护。有个这个源之后,使用 YUM 安装或更新 PHP、MySQL、phpMyAdmin 等服务器相关程序的时候就非常方便了。
Step 1: 安装 Remi Repository
## Install Remi & Epel Repository on RHEL/CentOS 6.4-6.0 - 32 Bit ##
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
## Install Remi & Epel Repository on RHEL/CentOS 6.4-6.0 - 64 Bit ## (6.5也可用)
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
## Install Remi Repository on RHEL/CentOS 5.9-5.0 - 32 Bit ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
## Install Remi Repository on RHEL/CentOS 5.9-5.0 - 64 Bit ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
Step 2: 安装 Apache, MySQL 5.5.32 & PHP 5.5.0
# yum --enablerepo=remi,remi-test install httpd mysql mysql-server php php-common
Step 3: 安装 PHP 5.5.0 模块
# yum --enablerepo=remi,remi-test install php-mysql php-gd php-mbstring php-xml
Step 4: 启动服务并配置 Apache & MySQL 5.5.32
service httpd start
service mysqld start
#下面定义mysql的root密码
/usr/bin/mysqladmin -u root password 'password'