note 128449 added to function.proc-open
| From: | GilPotts at main dot php dot net | Date: | Thu, 04 May 2023 03:58:20 +0000 |
| Subject: | note 128449 added to function.proc-open | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220405@lists.php.net to get a copy of this message | ||
This is not really a bug but more of an unexpected gotcha. If you pass in an array for $env and
include a modified PATH, that path does not take effect in PHP itself when starting the process. So
if you are trying to start an executable in the modified PATH by using just the executable name, PHP
and the OS won't find it and therefore will fail to start the process.
The fix is to let PHP know about the modified PATH by calling putenv("PATH=" . $newpath)
with the new path string so that the call to proc_open() will correctly locate the executable and
successfully run it.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.13.130 (proxied: 67.1.186.71)
----
Manual Page -- https://php.net/manual/en/function.proc-open.php
Edit -- https://main.php.net/note/edit/128449
Del: integrated -- https://main.php.net/note/delete/128449/integrated
Del: useless -- https://main.php.net/note/delete/128449/useless
Del: bad code -- https://main.php.net/note/delete/128449/bad+code
Del: spam -- https://main.php.net/note/delete/128449/spam
Del: non-english -- https://main.php.net/note/delete/128449/non-english
Del: in docs -- https://main.php.net/note/delete/128449/in+docs
Del: other reasons-- https://main.php.net/note/delete/128449
Reject -- https://main.php.net/note/reject/128449
Search -- https://main.php.net/manage/user-notes.php