Mike -- No longer here
Mike -- No longer here

Reputation: 2092

Remove delay from php's error_log file

I can't find an answer to this anywhere, so I'm asking here.

I'm just wondering if there's a way where I can see an error instantly printed into the php's error_log file when the error happens. Right now, my server is a standard setup running with cpanel/whm and the CPU usage and memory usage are always at normal levels.

The crazy thing is when errors happen, it seems I have to wait five minutes or more to see the entry in the php error_log file. If I check the log file right after I generate the error, then it doesn't get printed.

What can I do to minimize the waiting time for new errors to appear in the php's error_log file from the time the errors happen?

Upvotes: 2

Views: 801

Answers (2)

Telinov Dmitri
Telinov Dmitri

Reputation: 441

For php-fpm, I found this option at https://www.php.net/manual/en/install.fpm.configuration.php - set it to no:

log_buffering bool
Experimental logging without extra buffering. Default value: yes. Available as of PHP 7.3.0.

Upvotes: 0

rasha-saeed
rasha-saeed

Reputation: 76

It is a workaround not solution for the delay isssue. You can add this line at the end of your function

error_log(PHP_EOL, 3, $file);

Upvotes: 0

Related Questions