Tuesday, June 18, 2013

How to Suppress Default IIS Error and Display PHP Error Instead?


Ever wonder how to make IIS to show the PHP errors instead of its default "semi" blue-screen error page? So that it is easier to debug your PHP codes?

The answer is simple. Just go to your php.ini (mine is in C:\Program Files (x86)\PHP), change display_errors from Off to On. Reboot your PC. (I've tried just restarting the IIS service, it won't use the new PHP setting yet)

Walla! That simple!

If you want to turn off the error/warning altogether, you can always add "error_reporting = 0;" in your PHP script. For example, PHP script to spit out headers, JSON/XML/Binary data.



This following is the screen capture of the php.ini file:


You need to run this editor as Administrator to save this file as php.ini is a system file.

No comments:

Post a Comment