note 126521 added to function.exec
| From: | krjdev at gmail dot com | Date: | Wed, 20 Oct 2021 21:26:44 +0000 |
| Subject: | note 126521 added to function.exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217093@lists.php.net to get a copy of this message | ||
Note for OpenBSD users:
In the default configuration from OpenBSD, PHP runs into a chroot. So the exec() command will not
work. You will get a 127 (command not found) result code. The reason is, the shell (/bin/sh) is
missing in chroot, but the exec() command requires the shell.
A quick and dirty solution is to copy /bin/sh (which is statically linked) in the chroot directory:
<?php
$ cp /bin/sh /var/www/bin
?>
(I have noticed this on OpenBSD 7.0 with PHP 8.0.11.)
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 193.154.242.205)
----
Manual Page -- https://php.net/manual/en/function.exec.php
Edit -- https://main.php.net/note/edit/126521
Del: integrated -- https://main.php.net/note/delete/126521/integrated
Del: useless -- https://main.php.net/note/delete/126521/useless
Del: bad code -- https://main.php.net/note/delete/126521/bad+code
Del: spam -- https://main.php.net/note/delete/126521/spam
Del: non-english -- https://main.php.net/note/delete/126521/non-english
Del: in docs -- https://main.php.net/note/delete/126521/in+docs
Del: other reasons-- https://main.php.net/note/delete/126521
Reject -- https://main.php.net/note/reject/126521
Search -- https://main.php.net/manage/user-notes.php