PDA

View Full Version : How to supress errors in config.php except for a specific ip


bzcomputers
03-28-2014, 11:48 AM
I'd like to do some troubleshooting on a live 4.2.2 site. It currently has this in the config.php:
define('SKIP_ALL_ERRORS', true);

I'd like to bypass this for my specific id address so I can track down errors/warnings. I've tried something like this below:
if ($_SERVER['REMOTE_ADDR'] != 'xxx.xxx.xx.xx') { define('SKIP_ALL_ERRORS', true); }


...but it gives errors, I know I'm missing something obvious.

ozzy47
03-28-2014, 11:55 AM
Lets try this:

$my_unique_ip="XXX.XXX.XX.X"; // Change this IP to your Unique IP.
if ($_SERVER["REMOTE_ADDR"]!=$my_unique_ip) define('SKIP_ALL_ERRORS', true);

nhawk
03-28-2014, 11:57 AM
Either one of those should work.

What errors are you getting?

Remember, you're allowing errors to be shown to YOU when you do what you're doing. So yes... all sorts of errors can appear.

bzcomputers
03-28-2014, 12:12 PM
Either one of those should work.

What errors are you getting?


Looks like it was just the braces, once they were removed this worked:
if ($_SERVER['REMOTE_ADDR'] != 'xxx.xxx.xx.xx') define('SKIP_ALL_ERRORS', true);

Ozzy's works also.

Thanks.

ozzy47
03-28-2014, 12:17 PM
Excellent, glad to hear. :)