PHP disable error reporting when working locally but disable it online -
is there way disable error reporting when site on actual host people can view , enable when i'm working on locally on usb webserver?
i find pain toggle between error_reporting(1) , (0) whenever want debug. have set in connection file included on every page on website btw
edit: ended adding connection file
$addrip = $_server['remote_addr']; if($addrip == "::1" || $addrip == "127.0.0.1" ){ error_reporting(0); }else{ error_reporting(1); }
"@fred-ii- created similar myself guess thats solution, if post answer ill flag solution :)"
as per op's request post comment answer:
you can use of these:
if ($_server['http_host'] == 'localhost') { // } else { // else }
or:
$whitelist = array( '127.0.0.1' ); if(!in_array($_server['remote_addr'], $whitelist)) { // } else { // else }
Comments
Post a Comment