note 95651 added to function.shell-exec
| From: | codeslinger at compsalot dot com | Date: | Thu, 14 Jan 2010 02:47:24 +0000 |
| Subject: | note 95651 added to function.shell-exec | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164955@lists.php.net to get a copy of this message | ||
it took me a heck of a lot of head banging to finally solve this problem so I thought that I would
mention it here.
If you are using Eclipse and you try to do something like
<?php
$out = shell_exec("php -s $File"); //this fails
?>
it will always fail when run inside of the Eclipse debugger. This happens on both Linux and
Windows. I finally isolated the problem to changes that Eclipse makes to the environment when
debugging.
The fix is to force the ini setting. If you don't need an ini then -n is sufficient.
<?php
$out = shell_exec("php -n -s $File"); //this works
?>
Of course if you run it outside of the debugger then it works fine without the -n. You may want to
use a debug flag to control this behavior.
----
Server IP: 64.71.164.2
Probable Submitter: 71.35.165.229
----
Manual Page -- http://www.php.net/manual/en/function.shell-exec.php
Edit -- https://master.php.net/note/edit/95651
Del: integrated -- https://master.php.net/note/delete/95651/integrated
Del: useless -- https://master.php.net/note/delete/95651/useless
Del: bad code -- https://master.php.net/note/delete/95651/bad+code
Del: spam -- https://master.php.net/note/delete/95651/spam
Del: non-english -- https://master.php.net/note/delete/95651/non-english
Del: in docs -- https://master.php.net/note/delete/95651/in+docs
Del: other reasons-- https://master.php.net/note/delete/95651
Reject -- https://master.php.net/note/reject/95651
Search -- https://master.php.net/manage/user-notes.php