You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using the wordpress:php7.4-fpm-alpine image. We are logging to STDERR using following as example:
error_log($msg, 3, '/dev/stderr');
but do not see the message in Docker logs. If we replace /dev/stderr with a local filename such as /var/www/html/wp-debug.log the message does appear there.
Things we tried (none of which worked):
replace /dev/stderr with /proc/self/fd/2
replace /dev/stderr with /proc/1/fd/2
we have verified catch_workers_output is set to yes in /usr/local/etc/php-fpm.d/docker.conf.
below are the different kinds of error messages in wordpress logs:
[23-Mar-2021 18:48:55 UTC] PHP Warning: error_log(/dev/stderr): failed to open stream: No such file or directory in /var/www/html/wp-content/logging.php on line 11
[23-Mar-2021 20:26:06 UTC] PHP Warning: error_log(/proc/1/fd/2): failed to open stream: Permission denied in /var/www/html/wp-content/logging.php on line 11
[23-Mar-2021 21:13:15 UTC] PHP Warning: error_log(/proc/self/fd/2): failed to open stream: No such file or directory in /var/www/html/wp-content/logging.php on line 11
the /dev/stderr does clearly exist:
bash-5.0# ls -al /dev/stderr
lrwxrwxrwx 1 root root 15 Mar 23 20:04 /dev/stderr -> /proc/self/fd/2
bash-5.0# ls -al /proc/self/fd/2
lrwx------ 1 root root 64 Mar 23 21:18 /proc/self/fd/2 -> /dev/pts/0
bash-5.0# ls -al /dev/pts/0
crw--w---- 1 root tty 136, 0 Mar 23 21:18 /dev/pts/0
The text was updated successfully, but these errors were encountered:
The /proc/1/fd/2 should be the stderr of PID 1 so anything written there should then output in docker log docker-library/php#811 (comment)
I think the error_log(/proc/self/fd/2): failed to open stream: No such file or directory is because /proc/self/fd/ is redirected to /dev/pts/0 which only exists when you're "attached" to the container (with docker exec -it)
So what's the solution here? Is there something that can be done to prevent permission denied when trying to open /proc/1/fd/2? Can one chmod this file? is it safe?
bash-5.0# ls -al /proc/1/fd/2
l-wx------ 1 root root 64 Mar 23 20:04 /proc/1/fd/2 -> pipe:[33197]
I think the conclusion in docker-library/php#878 is that this is complicated and often doesn't work at all -- I don't think anyone's found a good generally applicable workaround for it.
We are using the
wordpress:php7.4-fpm-alpine
image. We are logging to STDERR using following as example:but do not see the message in Docker logs. If we replace
/dev/stderr
with a local filename such as/var/www/html/wp-debug.log
the message does appear there.Things we tried (none of which worked):
/dev/stderr
with/proc/self/fd/2
/dev/stderr
with/proc/1/fd/2
we have verified
catch_workers_output
is set toyes
in/usr/local/etc/php-fpm.d/docker.conf
.below are the different kinds of error messages in wordpress logs:
the
/dev/stderr
does clearly exist:The text was updated successfully, but these errors were encountered: