即使PHP.ini中的display_Errors=On,PHP中也没有错误

即使PHP.ini中的display_Errors=On,PHP中也没有错误,php,apache2,ubuntu-16.04,php-7,Php,Apache2,Ubuntu 16.04,Php 7,我正在Vagrant(Ubuntu 16.04、Apache2、PHP7)中设置一个LAMP堆栈,PHP没有显示任何错误。我有以下文件,该文件应返回错误: This is a PHP File <?php thisisnotafunction(); ?> <?php echo date("ThisIsAnInvalidArgument"); ?> 我检查了其中的每一个,设置了display\u errors=On,重新启动了apache2,但仍然没有错误。但是,将以下内

我正在Vagrant(Ubuntu 16.04、Apache2、PHP7)中设置一个LAMP堆栈,PHP没有显示任何错误。我有以下文件,该文件应返回错误:

This is a PHP File
<?php thisisnotafunction(); ?>
<?php echo date("ThisIsAnInvalidArgument"); ?>
我检查了其中的每一个,设置了
display\u errors=On
,重新启动了apache2,但仍然没有错误。但是,将以下内容添加到my index.php文件会显示错误:

<?php
    error_reporting( E_ALL );
    ini_set( "display_errors", 1 );
    require_once( "sample.php" );
?>

很明显,我的PHP安装程序知道如何处理错误。

使用
PHP--ini
命令将显示您使用的配置文件。

Apache指令可以设置或取消设置此标志,ini可能不是您安装时使用的(也不必称为PHP.ini,php7可以读取ini目录等)这确认了PHP使用的是哪个ini文件。谢谢另外,对于任何想找到答案的人来说,
display\u errors
在php.ini中显示了三次(通常显示两次,作为注释显示一次)。
<?php
    error_reporting( E_ALL );
    ini_set( "display_errors", 1 );
    require_once( "sample.php" );
?>
This is a PHP File 
Warning: require_once(sample.php): failed to open stream: No such file or directory in /var/www/html/index.php on line 6

Fatal error: require_once(): Failed opening required 'sample.php' (include_path='.:/usr/share/php') in /var/www/html/index.php on line 6