Show PHP errors in the page

TAGs: 1 Comment

Posted By: eligeske on in PHP

Showing php errors on your dev machine is useful while programming. But when you move a piece of code to staging or even dev and you have an issue you may need a quick solve, either log files or a quick Show Errors on Page while on off peak hours. My case it is a staging environment so no worries on showing the errors.

You can set it in your php.ini but placing in your code with php functions allows you to easily set up various configs for different environments.

error_reporting(0); // hides all errors
error_reporting(-1); // shows all errors

Pretty simple, and really assists with fast debugging.




One Response to "Show PHP errors in the page"

  1. Got to watch out cause there are different levels of errors. Instead of the 0, -1 or numbers you can use the constant wish are easier to understand in the code. You can use var_dump(debug_backtrace()); to see a complete trace of your code.


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>

Learning DHTMLX Suite UI

Learn the foundation of the DHTMLX Suite quickly while building a single page application with multiple components in harmony.

Popular post