[php-src] Issue #25077: php-fpm workers' log get silenced with config `catch_workers_output = yes` and `error_log = syslog`

From: Date: Sat, 31 Oct 2026 06:57:23 +0000
Subject: [php-src] Issue #25077: php-fpm workers' log get silenced with config `catch_workers_output = yes` and `error_log = syslog`
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-253946@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/25077 Author: n0099 ### Description Follow up of https://bugs.php.net/bug.php?id=79342. When the php-fpm config [catch_workers_output](https://www.php.net/manual/en/install.fpm.configuration.php#catch-workers-output) is enabled, and [error_log](https://www.php.net/manual/en/install.fpm.configuration.php#error-log) is syslog, all workers' log won't go syslog. --- I saw /proc/<php-fpm master pid>/fd/2 points to /dev/null, this is expected as https://github.com/php/php-src/blob/d4f79e2ee86a5dfd3b12f34d75af6d5bd0a0f9ab/sapi/fpm/fpm/fpm_stdio.c#L130-L132 https://github.com/php/php-src/blob/d4f79e2ee86a5dfd3b12f34d75af6d5bd0a0f9ab/sapi/fpm/fpm/fpm_stdio.c#L63-L66 https://github.com/php/php-src/blob/d4f79e2ee86a5dfd3b12f34d75af6d5bd0a0f9ab/sapi/fpm/fpm/fpm.c#L82 point stderr to stdout when php-fpm config error_log = syslog, and stdout was previously pointed to /dev/null: https://github.com/php/php-src/blob/d4f79e2ee86a5dfd3b12f34d75af6d5bd0a0f9ab/sapi/fpm/fpm/fpm_stdio.c#L27-L36 https://github.com/php/php-src/blob/d4f79e2ee86a5dfd3b12f34d75af6d5bd0a0f9ab/sapi/fpm/fpm/fpm.c#L57 This can prevent seeing duplicate logs from php-fpm in journalctl when using systemd service unit with the default value journal of option [StandardError=](https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#StandardError=) to run php-fpm with daemonize = off as php-fpm itself already reporting logs to syslog and journald should be syslogd on many distros using systemd. --- With php-fpm config catch_workers_output = yes, all workers' stderr are piped to master process, assume one of the worker's pid is 404: ```sh $ ls -l /proc/404/fd/2 l-wx------ 1 root root 64 Oct 31 05:58 /proc/404/fd/2 -> 'pipe:[1853673300]' $ find /proc -lname 'pipe:\[1853673300]' 2>/dev/null # https://superuser.com/q/401066/1777086#comment2862240_401619 /proc/317/task/317/fd/11 /proc/317/fd/11 /proc/404/task/404/fd/2 /proc/404/fd/2 $ lsof -d ^mem -a -p 317 # fd used by master process ``` So workers' stderr such as PHP error should be pipe to master process and then journald via syslog, but there's only log from master process in journalctl -u <php-fpm unit name>, such as NOTICE: ready to handle connections. When I strace into the master process: ```sh $ echo '<?php 1' > test.php $ strace -p 317 -e read,write -vs 999 & strace: Process 317 attached $ SCRIPT_FILENAME=$PWD/test.php REQUEST_METHOD=GET cgi-fcgi -bind -connect localhost:9000 # or path to unix domain socket of php-fpm Status: 500 Internal Server Error Content-type: text/html; charset=UTF-8 read(11 , "NOTICE: PHP message: PHP Parse error: syntax error, unexpected end of file in /foo/bar/test.php on line 2\n\0fscf\0", 1023) = 113 write(2, "[31-Oct-2026 06:41:53] WARNING: [pool roundcube] child 407 said into stderr: \"NOTICE: PHP message: PHP Parse error: syntax error, unexpected end of file in /foo/bar/test.php on line 2\"\n", 186) = 186 read(11, 0x7fff1dc02980, 1023) = -1 EAGAIN (Resource temporarily unavailable) ``` it just pipe the fd/11 that piped from worker process's stderr to its stderr, which is /dev/null. I guess it's caused by the hardcoded stderr destination: https://github.com/php/php-src/blob/d4f79e2ee86a5dfd3b12f34d75af6d5bd0a0f9ab/sapi/fpm/fpm/fpm_stdio.c#L195 https://github.com/php/php-src/blob/7ba31bb1934ae22c2d007135e89a38af131ec52e/sapi/fpm/fpm/zlog.c#L528-L556 that introduced in commit https://github.com/php/php-src/commit/3e5afbf0a80317216d98c6e5c0dd2eb54f34e438#diff-5af9050ab2bfafe95720d7badd345919c64c8fcd41a16089facf80a439ce86b0R190 of #2458 ### PHP Version ```plain PHP 8.5.12 (fpm-fcgi) (built: Oct 19 2026 17:02:46) (NTS) Copyright (c) The PHP Group Zend Engine v4.5.12, Copyright (c) Zend Technologies with Zend OPcache v8.5.12, Copyright (c), by Zend Technologies ``` ### Operating System _No response_

« previous php.bugs (#253946) next »