简体   繁体   中英

PHP error_log(“Message”); does not write to log

Until recently, I was able to use error_log("Message"); to write to /var/log/apache2/error.log. However, it seems to have stopped altogether now. I get nothing in the, expect the notices when I try to restart the Apache2 service.

I've also tried chmod 777 on the file to no effect.

What the error_log() function does with a single argument, depends on the error_log configuration setting.

See http://php.net/manual/en/function.error-log.php and http://php.net/manual/en/errorfunc.configuration.php#ini.error-log for details.

I think you want to ini_set("error_log", NULL) ; quoth the latter link above: "If this directive is not set, errors are sent to the SAPI error logger. For example, it is an error log in Apache or stderr in CLI."

(Of course, you might want to check what it is set to ( echo ini_get("error_log") ), and if possible, why.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM