> CentOS > CentOS服务器 > 环境配置 >

Yum Install Apache2.2.15, MySQL 5.5.28 & PHP 5.4.9 on RHEL 6.X/CentOS 6.X

Step 1: Installing Remi Repository

## Install Remi Repository on RHEL/CentOS 6.3-6.0
## rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Step 2: Installing Apache, MySQL 5.5.28 & PHP 5.4.9

 

## Installing on RHEL/CentOS 5-6 ##
# yum --enablerepo=remi,remi-test install httpd mysql mysql-server php php-common

Step 3: Installing PHP 5.4.9 Modules

## Installing on RHEL/CentOS 5-6 ##
# yum --enablerepo=remi,remi-test install php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo

Step 4: Starting/Stopping Apache & MySQL 5.5.28

## Enable Apache and MySQL on Run-Levels ##
# chkconfig --levels 235 httpd on
# chkconfig --levels 235 mysqld on

## Apache Commands ## 
# /etc/init.d/httpd start
# /etc/init.d/httpd stop
# /etc/init.d/httpd status

## MySQL Commands ## 
# /etc/init.d/mysqld start
# /etc/init.d/mysqld stop
# /etc/init.d/mysqld status

Step 5: Verifying Apache, MySQL 5.5.28 & PHP 5.4.9

1. Create a page called phpinfo.php under your Apache root directory and add the following lines to it. For example (/var/www/html/phpinfo.php).

<?php

     phpinfo ();
?>

2. Now access the page via web browser like http://localhost/phpinfo.php. You will see below screenshot.

Install PHP 5.4.9

PHP 5.4.9 Preview

Install MySQL 5.5.28

MySQL 5.5.28 Preview

That’s it!. If you are having any trouble installing, let me know via our comment section.

 

注意:

此环境安装好后,在后期可能会要加一些模块,会安装版不上去,应该这样安装

#yum –enablerepo=remi install XXXX

如:yum –enablerepo=remi install php-common

要不然默认安装的版本会是PHP 5.3的,会有冲突


 

(责任编辑:IT)