1.准备工作
httpd-2.2.16.tar php-5.3.3.tar MySQL-5.5.6_rc-1.linux2.6.i386.tar
2.先安装 Aapche 服务器
cd /soft
tar -zxvf http-2.2.16.tar
cd http
./configure --prefix=/usr/local/apache --enable-module=so
make ; make install
3. 再安装 Mysql
原以为我下的是Mysql的源码包, 解压了才知道 里面是六个 rpm 包 。 依次安装上就行了, 有安装顺序的,在安装过程中会有提示。
4. 安装 php
首先解压
./configure --prefix=/usr/local/php --with-mysql --with-apxs=/usr/loca/apache/bin/apxs
在这个地方可能会出现一些错误 例如:
./configure: line 4096: /usr/loca/apache/bin/apxs: No such file or directory
configure: error: Aborting
解决方法:
./configure --prefix=/usr/local/php --with-mysql --with-apxs2=/usr/loca/apache/bin/apxs
中间可能还会有一些错误,不过百度一下都可以找到解决方法的。
make;make install
5. 整合Apache 和 PHP
vi /usr/local/apache/conf/httpd.conf
在加载模块的地方加入
LoadModule php5_module modules/libphp5.so
然后在AddType application/x-gzip .gz .tgz 加入下面两行。
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-source .phps
再修改 DirectoryIndex index.html
成 DirectoryIndex index.html index.php
重启 Apache 服务器就OK了!