1. 程式人生 > >IIS 環境下 PHP無法顯示錯誤資訊------500錯誤

IIS 環境下 PHP無法顯示錯誤資訊------500錯誤

我使用的是window2012的伺服器。 在IIS+FastCGI中配置PHP後,如果php原始檔中存在錯誤,則不論是什麼錯誤,FastCGI都會返回 內部伺服器錯誤500的資訊,這給程式除錯帶來了麻煩。 解決這個問題的辦法如下:

1.PHP

首先開啟PHP的配置檔案php.ini,並做如下配置修改:

    log_errors = On
    html_errors = On 
    display_errors = On
    fastcgi.logging = 0 
    error_reporting = E_ALL & ~E_NOTICE 

2.Web網站

在網站的根目錄下面新建一個web.config檔案 新增如下程式碼:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
  </system.web>

  <system.webServer>
    <httpErrors errorMode="DetailedLocalOnly" existingResponse
="PassThrough">
</httpErrors> </system.webServer> </configuration>

如果還是有問題,你好好應該檢查一下檔案的許可權或者路徑問題! 希望可以幫到你!