我想~ 您會不會是 httpd.conf 有些註解沒有拿掉~
搜尋一下 httpd.conf 內容吧~
例如以下內容:
在 Dynamic Shared Object (DSO) Support
<IfDefine HAVE_PERL>
LoadModule perl_module modules/libperl.so
</IfDefine>
的下方是否有類似下面的設定:
<IfDefine HAVE_PHP>
LoadModule php_module modules/mod_php.so
</IfDefine>
<IfDefine HAVE_PHP3>
LoadModule php3_module modules/libphp3.so
</IfDefine>
<IfDefine HAVE_PHP4>
LoadModule php4_module modules/libphp4.so
</IfDefine>
再稍微下面一點:
<IfDefine HAVE_PERL>
AddModule mod_perl.c
</IfDefine>
的下方是否有類似下面的設定:
<IfDefine HAVE_PHP>
AddModule mod_php.c
</IfDefine>
<IfDefine HAVE_PHP3>
AddModule mod_php3.c
</IfDefine>
<IfDefine HAVE_PHP4>
AddModule mod_php4.c
</IfDefine>
DirectoryIndex 的設定 是否有 index.php 、 index.php3 或 index.php4 等(一搬來說, 如果您習慣寫的 php 程式副檔名都取為 .php 哪只要增加 index.php 幾可)
例如 DirectoryIndex index.html index.htm index.shtml index.php index.php4 index.php3 index.phtml index.cgi
下面這裡的設定可能是關鍵吧~ 瞧瞧自己的設定檔是否類似:
# AddType allows you to tweak mime.types without actually editing it, or to
# make certain files to be certain types.
#
# For example, the PHP 3.x module (not part of the Apache distribution - see
# http://www.php.net) will typically use:
#
<IfModule mod_php3.c>
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .phps
</IfModule>
#
# And for PHP 4.x, use:
#
<IfModule mod_php4.c>
AddType application/x-httpd-php .php .php4 .php3 .phtml
AddType application/x-httpd-php-source .phps
</IfModule>
#
# For PHP/FI (PHP2), use:
#
<IfModule mod_php.c>
AddType application/x-httpd-php .phtml
</IfModule>
或許每一個 Apache 的設定檔都有所差異, 不過都是瞞類似的
以上就已您自己的需要而定, 完全相同並不盡然理想, 看看 /var/log/httpd/access.log 與 error.log 檔, 是否在運作哪裡出錯
可以更快的解決這個問題