Turn on in browser error reporting in PHP

Posted on the February 18th, 2009 under PHP by admin

When developing in PHP it’s easier to deal with errors when you see them in your browser. It’s the quickest and easiest way to see them and eventually fix them. This solution will use PHP 5.2.8.

For this example I’ll be using the php.ini file on a Windows operating system. You should find the php.ini in the following directory..

C:\Program Files\PHP\php.ini

Open this file in a text editor such as Notepad.

On line 354 there should be a line which reads: error_reporting = E_ALL. Make sure this is uncommented (remove any semi-colon from the left of that line). On line 373 these should be a line which reads: display_errors = Off.

Edit that line so it reads display_errors = On. Save the php.ini file and restart your web server – the quickest way to do this is to bring up a command prompt and type “iisreset“.

Be aware that display_errors should only be turned on in a development environment for test purposes only!

Share this Solution:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Technorati
  • Google Bookmarks
  • Facebook
  • Live
  • Sphinn
  • Furl

Leave a Reply
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>