sorin
sorin

Reputation: 170410

How to configure PHP and nginx to display errors only for specific IP addresses?

How do I configure PHP and nginx to display errors only for specific IP addresses?

Upvotes: 0

Views: 766

Answers (1)

Ezequiel Muns
Ezequiel Muns

Reputation: 7742

You could first set PHP to not display errors at all (display_errors = Off in php.ini), then use the auto_prepend_file directive in your php.ini to include this script:

<?php
$allowed_ips = array('111.111.111.111', ...);
if (in_array($_SERVER['REMOTE_ADDR'], $allowed_ips)) {
    ini_set('display_errors', '1');
}

Upvotes: 3

Related Questions