ทำ IIS7.0 ให้แสดง PHP Error

ปกติแล้ว IIS จะไม่แสดง Error หรือ Notice จาก การประมวลผล PHP โดยตรงครับ ต้องไปหาดูใน log
ผมมีวิธี ดังนี้ครับ
1. แบบทั้งหมด (ทุก site ใน server)

appcmd.exe set config -section:system.webServer/httpErrors
/existingResponse:"PassThrough" /commit:apphost


2.เลือกบางเว็บไซต์

appcmd.exe set config "Default Web Site/application(ชื่อเว็บไซต์)"  -section:system.webServer/httpErrors /existingResponse

หรือจะเปิดไฟล์ web.config แล้ว แก้ไขตามนี้


<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors existingResponse="PassThrough" />
    </system.webServer>
</configuration> 

แล้วลองดูผลครับ

credit: http://blogs.iis.net/kehand/archive/2009/08/09/php-and-custom-error-pages.aspx

แสดงความคิดเห็น