Keeping Issues Private

There are many times I see postings to add 'display_errors' = true and define('DEVELOPMENT', true) suggested to be added to config.local.php.



Here is an alternate approach that I use that might keep you from publishing your issues to your clients but ensuring that you can see issues as they come up and also have access to the debugger all the time.



Create a local_conf.php file in the root of your store that contains:


if( !defined('BOOTSTRAP') ) die('Access denied');
define('my_debug_enabled', true); // change to false to disable
function my_debug_ip() {
$debug_ips = array('[YOUR IP ADDRESS]', '[YOUR DEVELOPERS IP ADDRESS]', '[ETC']);
return in_array($_SERVER['REMOTE_ADDR'], $debug_ips);
}
if( defined('my_debug_enabled') && my_debug_enabled && my_debug_ip() ) {
define('DEVELOPMENT', true);
error_reporting(E_ALL);
ini_set('display_errors', true);
define('DEBUG_MODE', true);
}


This will enable these things for your eyes only. You can then also use the my_debug_ip() function in other areas of code to add diagnostic display of information when working on a live site.



You can also further qualify this for AREA == 'C' if you want to restrict to customer view only, etc.



Just a tid-bit to maybe make life easier and a bit more private.