My WordPress error log is going to
/var/log/php-fpm/www-error.log. That’s not where I want it. In fact, it took me too long to figure that out. (I’m new to WP and PHP).
I’ve tried to redirect it with the following in my
but it has no effect. This code is placed before/above the “stop editing” warning. I’ve tried other log file locations like /tmp, still, my WP_DEBUG_LOG setting is ignored. I do receive the “hello” message that I wrote – it’s just in the wrong file.
I can successfully write to other locations using the form of error_log() that takes a path, like error_log(‘hello’, 3, ‘/tmp/mylog.log’).
ini_get(‘error_log’) returns the path that is being used.
My php.ini does not specify a log location.
It’s not a file permissions problem.
I’m self-hosting WP 5.5.1 on AWS Linux 2 (like Centos 7), with PHP 7.2.24
Update Oct 12:
I learned that php-fpm is capturing the output, and that php-fpm can be configured to change this behavior. I was not able to get what I want, and I’m not motivated to continue this effort, but others with the same problem may want to look at these settings in
see also https://stackoverflow.com/questions/8677493/php-fpm-doesnt-write-to-error-log