1.下载必须文件
(1)下载Apache(点击下载)--httpd-2.2.4.tar.gz
(2)下载Mysql(点击下载)--mysql-5.0.41.tar.gz
(3)下载PHP(点击下载)--php-5.2.4.tar.gz
2.安装(*注意一定要按照顺序安装)
(1)安装Apache
#tar -zvxf httpd-2.2.4.tar.gz
#cd httpd-2.2.4
#./configure --prefix=/usr/local/apache --enable-module=so
#make
#make install
(2)安装Mysql
#tar -zvxf mysql-5.0.41.tar.gz
#cd mysql-5.0.41
#./configure --prefix=/usr/local/mysql --with-charset=utf8
#make
#make install
(3)配置mysql
A.添加mysql组和用户
#/usr/local/sbin/groupadd mysql
#/usr/local/sbin/useradd -g mysql mysql
B.设定用户访问权限
#cd /usr/local/mysql
#chown -R mysql .
#chgrp -R mysql .
(*注意上面都有点号,意思不用我说了*)
C.安装数据库文件
#mysql原始安装目录(即mysql-5.0.41)/scripts/mysql_install_db --user=mysql
D.运行mysql
#/usr/local/mysql/bin/mysqld_safe -user=mysql &
E.设置root用户密码为123456
#/usr/local/mysql/bin/mysqladmin -uroot passwd 123456
(4)安装PHP(*关键*)
#tar -zvxf php-5.2.4.tar.gz
#cd php-5.2.4
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql
(*这里最关键,也是我之前说的为什么要按照步骤来的原因*)
#make
#make install
(5)启动apache
#/usr/local/apache/bin/httpd -f /usr/local/apache/conf/httpd.conf
*Cannot load /www/modules/libphp5.so into server error*
原因:
he problem is caused by the security system - selinux, blocking it's access to libph5.so
#chcon -t texrel_shlib_t /usr/local/apache/modules/libphp5.so
再测试……通过,原来是selinux安全
(6)重新配置Apache,使他支持php
#vi /usr/local/apache/conf/httpd.conf
找到LoadModule php5_module modules/libphp5.so这一行
在他下面添加:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
再启动apache测试……
#/usr/local/apache/bin/apachectl restart
********************************结束********************************