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