如果我前往我網站的主頁http://www.website.com(在全新的伺服器上)index.php 被下載而不是被處理。我在其他資料夾上沒有同樣的問題。我的 .htaccess 內容如下:
AddHandler php5-script .php
這可能是什麼?我懷疑這是 php config / 或 htaccess 的問題,但我無法弄清楚。請幫忙!
編輯:我不知道這是否有幫助:這是一個WordPress安裝,我只在網站的公共部分遇到這個問題,而不是在管理端(正確呈現)
答案1
我相信你的處理者是錯的。根據http://wiki.apache.org/httpd/PHPDownload你需要使用:
# (other modules)
# Replace the following with the correct path and version of your php module
LoadModule php5_module modules/libphp5.so
# (other modules)
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
答案2
嘗試一個簡單的腳本,看看它是否有效。 index.php 可能有問題。
in test.php:
<?php echo phpinfo(); ?>