Sometimes when doing some development from a subdirectory of a domain (that does not affect the main application), it would be useful to have errors displayed to the screen, but not enabling on a global-wide basis. There’s a way to do this within your application by just added a bit of configuration information at the top of your PHP file. Normally, you will want to include it in a file that is included on every page, dynamically, so that you don’t have to include this configuration information on multiple files. Just place the following PHP code at the top of your file (such as the functions.php
file):
error_reporting(E_ALL); ini_set("display_errors", "1"); |
Easy as that, and now you have PHP errors now displaying for this application, but nothing else (such as production code) will display errors.