IeuanG
IeuanG

Reputation: 504

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.

Upvotes: 1

Views: 412

Answers (1)

The Sidhekin
The Sidhekin

Reputation: 283

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.)

Upvotes: 1

Related Questions