[PHP] exec from process (deamon) without shell

2007-03-01 Thread Peter Lauri
Hi, I have a very complex script that is being called by a running deamon that doesn't have any shell. To simplify it I make this script, that is also failing: #/thepathtophp ?php exec(ls -lrt, $stdout, $exitcode); if($exitcode!=0) { echo Command ls -lrt could not be

Re: [PHP] exec from process (deamon) without shell

2007-03-01 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-03-01 18:28:35 +0200: #/thepathtophp ?php exec(ls -lrt, $stdout, $exitcode); if($exitcode!=0) { echo Command ls -lrt could not be executed correctly. Exit code: $exitcode\n; } else { echo Result:\n; foreach($stdout AS

Re: [PHP] exec from process (deamon) without shell

2007-03-01 Thread lists
Quoting Roman Neuhauser [EMAIL PROTECTED]: # [EMAIL PROTECTED] / 2007-03-01 18:28:35 +0200: #/thepathtophp ?php exec(ls -lrt, $stdout, $exitcode); if($exitcode!=0) { echo Command ls -lrt could not be executed correctly. Exit code: $exitcode\n; } else { echo

Re: [PHP] exec from process (deamon) without shell

2007-03-01 Thread lists
Quoting Roman Neuhauser [EMAIL PROTECTED]: # [EMAIL PROTECTED] / 2007-03-01 18:28:35 +0200: #/thepathtophp ?php exec(ls -lrt, $stdout, $exitcode); if($exitcode!=0) { echo Command ls -lrt could not be executed correctly. Exit code: $exitcode\n; } else { echo

Re: [PHP] exec from process (deamon) without shell

2007-03-01 Thread Richard Lynch
On Thu, March 1, 2007 10:28 am, Peter Lauri wrote: I have a very complex script that is being called by a running deamon that doesn't have any shell. To simplify it I make this script, that is also failing: PHP also uses a mini non-shell thingie to run exec. As such, it has no home

RE: [PHP] exec from process (deamon) without shell

2007-03-01 Thread Peter Lauri
site www.carbonfree.org.uk - become Carbon Free -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Friday, March 02, 2007 12:29 AM To: Peter Lauri Cc: 'PHP Mailing' Subject: Re: [PHP] exec from process (deamon) without shell On Thu, March 1, 2007 10:28 am, Peter

Re: [PHP] exec from process (deamon) without shell

2007-03-01 Thread Richard Lynch
On Thu, March 1, 2007 12:56 pm, [EMAIL PROTECTED] 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

Re: [PHP] exec from process (deamon) without shell

2007-03-01 Thread Richard Lynch
Add a nice clean line to the end of your PHP scripts: exit 0; //exit cleanly If your PHP scripts' last function call returns, say, -1, and then PHP just passes that back on out, it's probably going to look like an error code to the outermost shell, if you see what I mean... I'm not promising

RE: [PHP] exec from process (deamon) without shell

2007-03-01 Thread Peter Lauri
-Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Friday, March 02, 2007 12:35 AM To: [EMAIL PROTECTED] Cc: Roman Neuhauser; 'PHP Mailing' Subject: Re: [PHP] exec from process (deamon) without shell On Thu, March 1, 2007 12:56 pm, [EMAIL PROTECTED] wrote: I

RE: [PHP] exec from process (deamon) without shell

2007-03-01 Thread Peter Lauri
-Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Friday, March 02, 2007 12:37 AM To: [EMAIL PROTECTED] Cc: Roman Neuhauser; 'PHP Mailing' Subject: Re: [PHP] exec from process (deamon) without shell Add a nice clean line to the end of your PHP scripts: exit