note 119134 added to function.proc-open
| From: | stoller at leonex dot de | Date: | Fri, 08 Apr 2016 07:37:43 +0000 |
| Subject: | note 119134 added to function.proc-open | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205180@lists.php.net to get a copy of this message | ||
If you are working on Windows and try to proc_open an executable that contains spaces in its path,
you will get into trouble.
But there's a workaround which works quite well. I have found it here: http://stackoverflow.com/a/4410389/1119601
For example, if you want to execute "C:\Program Files\nodejs\node.exe", you will get the
error that the command could not be found.
Try this:
<?php
$cmd = 'C:\\Program Files\\nodejs\\node.exe';
if (strtolower(substr(PHP_OS,0,3)) === 'win') {
$cmd = sprintf('cd %s && %s', escapeshellarg(dirname($cmd)), basename($cmd));
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 80.87.117.30
----
Manual Page -- http://php.net/manual/en/function.proc-open.php
Edit -- https://master.php.net/note/edit/119134
Del: integrated -- https://master.php.net/note/delete/119134/integrated
Del: useless -- https://master.php.net/note/delete/119134/useless
Del: bad code -- https://master.php.net/note/delete/119134/bad+code
Del: spam -- https://master.php.net/note/delete/119134/spam
Del: non-english -- https://master.php.net/note/delete/119134/non-english
Del: in docs -- https://master.php.net/note/delete/119134/in+docs
Del: other reasons-- https://master.php.net/note/delete/119134
Reject -- https://master.php.net/note/reject/119134
Search -- https://master.php.net/manage/user-notes.php