====CentOS5.5+Apache2.2.24+MySQL5.1.45+Php5.3.20
====系统约定
01 源码包存放路径:/usr/local/src
02 apache安装目录:/usr/local/apache
03 mysql安装目录:/usr/local/mysql
04 php安装目录:/usr/local/php5
05 软件包列表----httpd-2.2.24.tar.gz
     mysql-5.1.45.tar.gz
     php-5.3.20.tar.gz
====安装编译环境所需开发工具,开发包及基础库文件等
06 yum -y groupinstall "Development Tools" "Development Libraries" "X Software Development"
====编译安装apache
07 mkdir -p /usr/local/apache
08 cd /usr/local/src
09 tar xf httpd-2.2.24.tar.gz
10 cd httpd-2.2.24
11 ./configure --help
12 ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-ssl --enable-so  --with-zlib --enable-rewrite --enable-mods-shared=most --enable-proxy --enable-proxy-connect --enable-proxy-http
13 make && make install
14 vim /etc/profile添加PATH=$PATH:/usr/local/apache/bin
15 . !$
16 ln -sv /usr/local/apache/include /usr/include/apache
17 vim /etc/ld.so.conf.d/apache.conf添加/usr/local/apache/lib
18 ldconfig -v
====编译安装mysql
19 groupadd mysql
20 useradd -g mysql -s /bin/false -M mysql
21 mkdir -p /usr/local/mysql
22 chown -R mysql:mysql /usr/local/mysql
23 cd /usr/local/src
24 tar xf mysql-5.1.45.tar.gz
25 cd mysql-5.1.45
26 ./configure --help
27 ./configure --prefix=/usr/local/mysql --sysconfdir=/etc --with-mysqld-user=mysql --without-debug --with-mysqld-ldflags=--all-static --with-client-ldflags=--all-static --with-plugins=innobase
28 make && make install
29 vim /etc/profile添加/usr/local/mysql/bin
30 . !$
31 ln -sv /usr/local/mysql/inclued /usr/include/mysql
32 vim /etc/ld.so.conf.d/mysql.conf添加/usr/local/mysql/lib
33 ldconfig -v
33 mkdir -p /data/mydata
34 ./scripts/mysql_install_db --help
35 ./scripts/mysql_install_db --user=mysql --datadir=/data/mydata
36 cp support-files/my-large.cnf /etc/my.cnf
37 vim /etc/my.cnf添加datadir = /data/mydata
38 cp support-files/mysql.server /etc/init.d/mysqld
39 chmod +x !$
40 chkconfig --add mysqld
41 chkconfig mysqld on
42 service mysqld start
====编译安装php
43 tar xf php-5.3.20.tar.gz
44 cd php-5.3.20
45 ./configure --help
46 ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring=all --with-jpeg --with-gd --with-curl
47 make && make install
48 vim /etc/profile添加/usr/local/php5/bin
48 . !$
49 cp php.ini-production /usr/local/php5/lib/php.ini
50 vim /etc/httpd/httpd.conf添加AddType application/x-httpd-php .php与index.php
====测试php
cd /usr/local/apache/htdocs
rm -rf index.html
echo -e "" > index.php
保存退出重启httpd服务
service httpd restart
====测试php与mysql的连接
vim index.php插入一下内容

====设置MySQL数据库
mysqladmin -u root password 'Mysql_p@sswd_194'
mysql -uroot -pMysql_p@sswd_194
select host,user,password from mysql.user;
delete from mysql.user where password='';
flush privileges;
grant all privileges on *.* to root@'%' identified by 'Mysql_p@sswd_194' with grant option;