RE: [PHP] exec from process (deamon) without shell
| From: | Peter Lauri | Date: | Thu, 01 Mar 2007 23:05:16 +0000 |
| Subject: | RE: [PHP] exec from process (deamon) without shell | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249689@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Richard Lynch [mailto:ceo@l-i-e.com]
> Sent: Friday, March 02, 2007 12:35 AM
> To: lists@dwsasia.com
> Cc: Roman Neuhauser; 'PHP Mailing'
> Subject: Re: [PHP] exec from process (deamon) without shell
>
> On Thu, March 1, 2007 12:56 pm, lists@dwsasia.com wrote:
> > I tried with /bin/ls but still same thing. I just found out that the
> > exitcode is -1 but the $stdout actually gives correct answer. But that
> > doesn't make sense. How can I then control what action to take
> > depending on the exitcode?
>
> I *think* this could be the result of trying to ls a bunch of files,
> some of which you don't have permission to 'ls', so you are getting a
> partial list of stuff, but also an error code for trying to ls stuff
> you shouldn't have been doing that too, if you see what I mean...
>
> I am hoping that your real script is a bit more complicated, as you
> currently have a shell script that runs PHP only to run a shell script
> that just does 'ls', which, really, you could probably just splat into
> your shell script without PHP being involved...
>
[Peter Lauri - DWS Asia]
It is a much more complicated logic, so therefore I am not using a shell
script. I will examine how perl acts on executing the same commands and if
that is catching 0 as error code I might move to run perl instead.