Enable error messages with PHP

Use the code below to display error messages while debugging a PHP web page. You should only use this on local development server as anyone viewing the page will see some server-side logic.

It has gotten me out of many a jam….

<?php
 ini_set("display_errors", 1);  //Display errors to the screen
 ini_set("track_errors", 1);  //Set last error message to variable ($php_errormsg)
 ini_set("html_errors", 1);  //Turn off HTML tags in error messages.
 error_reporting(E_ALL);  //Catch all errors and warnings
 ?>

More info here :http://php.net/manual/en/errorfunc.configuration.php

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>