-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Description
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