实验环境及软件版本:
CentOS版本: 6.6(2.6.32.-504.el6.x86_64)
apache版本: apache2.2.27
MySQL版本: Mysql-5.6.23
php版本: php-5.3.27
一、关闭防火墙:service iptables stop
chkconfig iptables off
二、关闭selinux: sed -i 's/SELINUX=disabled/SELINUX=enforcing/g' /etc/selinux/config
init 6 重启系统一定要!
三、apache安装
安装依赖:yum -y install zlib zlib-devel
tar zxvf apr-1.5.1.tar.gz
cd apr-1.5.1
./config --prefix=/usr/local/apr
make && make install
tar zxvf apr-util-1.5.4.tar.gz
cd apr-util-1.5.4
./config --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
2.安装apache: tar zxvf apache2.2.27.tar.gz
cd apache2.2.27
mkdir /application
./configure --prefix=/application/apache2.2.27 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make && make install
ln -s /application/apache2.2.27/ /application/apache/
启动:/application/apache/bin/apachectl start
echo "/application/apache/bin/apachectl start" >>/etc/rc.local 加入开机启动
查看是否启动功能:
[root@LAMP tools]# lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 1344 root 4u IPv6 10747 0t0 TCP *:http (LISTEN)
httpd 62462 wapp 4u IPv6 10747 0t0 TCP *:http (LISTEN)
httpd 62463 wapp 4u IPv6 10747 0t0 TCP *:http (LISTEN)
httpd 62464 wapp 4u IPv6 10747 0t0 TCP *:http (LISTEN)
httpd 62546 wapp 4u IPv6 10747 0t0 TCP *:http (LISTEN)
四、源码安装Mysql-5.6.23
请移步:,这里不在描述
五、php安装
1.安装依赖:yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib- devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel -y
tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
[root@LAMP libiconv-1.14]# ./configure --prefix=/usr/local/libiconv
make && make install
2.php安装: tar zxvf php-5.3.27.tar.gz
./configure --prefix=/application/php-5.3.27 --with-apxs2=/application/apache/bin/apxs --with-mysql=/usr/local/mysql --with-xmlrpc --with-openssl --with-zlib --with-freetype-dir --with-gd --with-jpeg-dir --with-png-dir --with-iconv=/usr/local/libiconv --enable-short-tags --enable-sockets --with-zend-multibyte --enable-soap --enable-mbstring --enable-static --enable-gd-native-ttf --with-curl --with-xsl --enable-ftp --with-libxml-dir --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
出错:configure: error: Cannot find MySQL header files under /usr/local/mysql.
[root@localhost php-5.5.6]# find / -name mysql.h
/usr/include/mysql/mysql.h
查找到mysql.h文件,我们更改参数为--with-mysql=/usr,如果没有的话,请安装mysql-devel包,
[root@localhost php-5.5.6]# yum install mysql-devel