[php-src] Issue #8240: Misleading error message on popen() when /bin/sh is missing

From: Date: Tue, 22 Mar 2022 14:33:33 +0000
Subject: [php-src] Issue #8240: Misleading error message on popen() when /bin/sh is missing
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-240455@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8240 Author: dilyanpalauzov ### Description I use PHP 7.4.28, but I do not expect that the described problem has changed in newer versions. I run PHP-FPM in chrooted environment. That environment had no /bin/sh. The php-fpm.conf file contans: ``` php_admin_value[sendmail_path]=/chr/sbin/mini_sendmail -t -i ``` so I would expect that the file is executed, whenever PHP's mail() function is called. As it turned out, at least when calling WordPress’ wp_mail(), and running php-fpm under strace, php calls /bin/sh /chr/sbin/mini_sendmail. The same happens, when I call just popen('/ldconfig', 'r'). The error message in the latter case is “Cannot allocate memory”, in the former case the error message was that the process cannot be forked (I do not remember the precise text). Now, when PHP relies on /bin/sh to call exec() or system() and /bin/sh is missing, PHP shall neither report, that it cannot fork, nor that it cannot allocate enough memory. It shall report, that /bin/sh is missing in the chroot-ed environment. ### PHP Version PHP 7.4.28, ### Operating System Linux from Scratch

« previous php.bugs (#240455) next »