如何配置 PHP 和 nginx 以仅显示特定 IP 地址的错误


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

如何配置 PHP 和 nginx 以仅显示特定 IP 地址的错误?

你可以

先将PHP设置为完全不显示错误(display_errors = Offphp.ini中),然后在php中使用auto_prepend_file指令.ini以包含以下脚本:

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