6、编译安装支持PHP的Apache
a.首先安装apache,假设将它安装到/www目录中,并以模块方式加载PHP
[root@netserver ids]#tar -xvzf httpd-2.0.47.tar.gz
[root@netserver ids]#cd httpd_2.0.47
[root@netserver httpd_2.0.47]#./configure --prefix=/www --enable-so
[root@netserver httpd_2.0.47]#make
[root@netserver httpd_2.0.47]#make install
用以下命令,看看apahce是否能启动起来
[root@netserver httpd_2.0.47]#/www/bin/apachectl start
(因为我们还没有配置httpd.conf,所以这里会提示没有设置Server Name,不用理会)
[root@netserver httpd_2.0.47]#cd ..
B.接下来安装PHP
[root@netserver ids]#tar -xvzf php-4.3.3.tar.gz
[root@netserver ids]#cd php-4.3.3
[root@netserver php-4.3.3]#./configure --prefix=/www/php --with-apxs2=/www/bin/apxs --with-config- filepath=/www/php --enable-sockets --with-mysql=/usr/local/mysql --with-zlibdir=/usr/local --with- gd (在实际书写的时候,请写成一行)
[root@netserver php-4.3.3]#make
[root@netserver php-4.3.3]#make install
[root@netserver php-4.3.3]#cp php.ini-dist /www/php/php.ini
C.配置apache的httpd.conf文件和PHP的php.ini文件
[root@netserver php-4.3.3]# vi /www/conf/httpd.conf
改变以下几行为所写的样式(如果文中没有,请添加该行)
ServerRoot "/www"
DocumentRoot "/www/htdocs"
LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .php .php3 .php4
DirectoryIndex index.php default.php index.htm default.htm index.html default.html
AddDefaultCharset GB2312
ServerName (你的ip地址):80
[root@netserver php-4.3.3]# vi /www/php/php.ini
将 register_globals = Off 这行改为register_globals = On