first, software and system version
System Download Address:
Package Download Address: Http://xiazai.jb51.net/201611/yuanma/php+apache+mysql (jb51.net). rar
download Package/swap source
(1) Download and install required software tools
Yum install-y wget vim unzip zip
(2) Exchange source
1, first uninstall the previously installed Epel to avoid affecting
Rpm-e Epel-release
2. Empty the Yum cache
Yum Clean All
Yum Makecache
3, rm-rf/etc/yum.repos.d/* (when performing this operation, remember to install the wget in advance or you will have to mount the disc with RPM installed wget. )
4. Download Ali
Wget-p/etc/yum.repos.d/http://mirrors.aliyun.com/repo/epel-6.repohttp://mirrors.aliyun.com/repo/centos-6.repo
5.
Yum Repolist
Third, install MySQL
(1) Decompression
TAR-ZXVF mysql-5.1.72-linux-x86_64-glibc23.tar.gz
(2) Configuring MySQL
MV Mysql-5.1.72-linux-x86_64-glibc23/usr/local/mysql cd/usr/local/mysqluseradd-s/sbin/nologin mysqlmkdir-p/data/ Mysqlchown-r Mysql:mysql/data/mysql
./scripts/mysql_install_db--user=mysql--datadir=/data/mysql
Check if compilation is successful
echo $?
(3) Make MySQL service
CP SUPPORT-FILES/MY-LARGE.CNF/ETC/MY.CNFCP Support-files/mysql.server/etc/init.d/mysqldchmod 755/etc/init.d/ Mysqldvim/etc/init.d/mysqld
Modify File Contents
Basedir=/usr/local/mysql (MySQL installation directory)
Datadir=/data/mysqlmysql database directory)
Chkconfig--add mysqld
Chkconfig mysqld on
IV. installation of Apache
(1) Installing the software operating environment GCC
Yum install-y gcc
(2) Decompression
TAR-JXVF httpd-2.2.27.tar.bz2
(3) Compiling
./configure--prefix=/usr/local/apache2--enable-mods-shared=most--enable-so
(4) Installation
Make
Make install
V. Installation of PHP
(1) Decompression
TAR-ZXVF php-5.3.28.tar.gz
(2) Install the required software plugin for PHP
Yum install-y libxml2-devel.x86_64yum install-y openssl-devel.x86_64yum install-y bzip2-devel.x86_64yum install-y LIBJ Peg-turbo-devel.x86_64yum install-y Libpng-devel.x86_64yum install-y Freetype-devel.x86_64yum install-y Libmcrypt-devel.x86_64
(3) Compiling
./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-path=/usr/local/ Php/etc--with-mysql=/usr/local/mysql--with-libxml-dir--with-gd--with-jpeg-dir--with-png-dir--with-freetype-dir --with-iconv-dir--with-zlib-dir--with-bz2--with-openssl--with-mcrypt--enable-soap--enable-gd-native-ttf-- Enable-mbstring--enable-sockets--enable-exif--disable-ipv6
(4) Installation
Make
Make install
Vi. Editing configuration Files
(1) vim/usr/local/apache2/conf/httpd.conf found:
<directory/> Options followsymlinks allowoverride None Order deny,allow deny from all</directory>
Switch
<directory/> Options followsymlinks allowoverride None Order deny,allow allow from all</directory>
Found it:
AddType application/x-gzip. gz. tgz
Under this line, add the following:
AddType application/x-httpd-php. php
Found it:
<ifmodule dir_module> DirectoryIndex index.html</ifmodule>
Change the line to read:
<ifmodule dir_module> directoryindex index.html index.htm index.php</ifmodule>
Found it:
#ServerName www.example.com:80
Modified to:
ServerName localhost:80
2 Test parsing PHP
vim/usr/local/apache2/htdocs/1.php
Write:
<?phpphpinfo ();? >
Browser Open: Address/1.php
Installation is complete from this PHP environment
Note: 1. System networking is required during installation, and if no network is available, download the relevant RPM package for installation. (I myself have been directly imported through the virtual machine template, not the virtual environment before the optional method)
2.apache did not make service, Apache do Service will be introduced in the next, in addition to MySQL installation is no password, you can set your own.
The above is the PHP environment Building (PHP+APACHE+MYSQL) Details of the content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!