Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 错误\u日志未按预期工作_Php_Error Handling_Error Logging_Error Log - Fatal编程技术网

Php 错误\u日志未按预期工作

Php 错误\u日志未按预期工作,php,error-handling,error-logging,error-log,Php,Error Handling,Error Logging,Error Log,我有以下基本代码: <?php //http://localhost/error_log.php echo "write to the error_log"; error_log("error_log entry"); //error_log("error_log entry",0); ?> 但是当我检查错误日志时,即/var/log/apache2/error.log,我看不到任何错误日志消息 为什么这些没有被输入到错误日志中?如果在没有第二个

我有以下基本代码:

<?php

    //http://localhost/error_log.php
    echo "write to the error_log";
    error_log("error_log entry");
    //error_log("error_log entry",0);

?>
但是当我检查错误日志时,即
/var/log/apache2/error.log
,我看不到任何错误日志消息


为什么这些没有被输入到错误日志中?

如果在没有第二个参数的情况下调用它,这意味着默认值为0

0   message is sent to PHP's system logger, using the Operating System's system logging mechanism or a file, depending on what the error_log configuration directive is set to. This is the default option.
现在要看天气了

如果这里不是“stderr”,php将不会登录到apache错误日志中

将您的日志消息发送到

现在这取决于您是如何配置的

但请看一看福林日志

tail /var/log/syslog
tail /var/log/messages
tail /var/log/php
tail /var/log/php.log

您的消息应该在其中一个日志中。

error.log
不会记录任何内容,除非error\u log.php页面出错

access.log
记录Apache服务器处理的所有事件

这就是
error.log
不记录事件的原因


检查更多信息

行为取决于
错误日志
配置指令的设置。
ini\u得到('error\u log')
说了什么?
tail /var/log/syslog
tail /var/log/messages
tail /var/log/php
tail /var/log/php.log