Re: Re[2]: [PHP] executing a PHP (shell script) through PHP (module)

From: Date: Tue, 09 Oct 2001 23:21:21 +0000
Subject: Re: Re[2]: [PHP] executing a PHP (shell script) through PHP (module)
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-70551@lists.php.net to get a copy of this message
Odd. Maybe it has to do with the fact that exec returns the last line... Perhaps if you put a /n at the end of the last line? Perl might return it automatically @ the end of a script (php doesn't and I always forget to do it...). just a shot in the dark. Anyone else have any ideas? On Tuesday 09 October 2001 01:11 am, you wrote: > OK but how do you explain that the page shows "test" with the PERL script > and nothing with the PHP script ... that is what is strange .... > > I know the way system() works ;) > > > Exec only returns the last line. If you want all the output, you should > > use > > > backticks (unless you want to exec("command > file.txt:) then read from > > the > > > file...) from php man: "exec() executes the given command, however it > > does not output anything. It simply returns the last line from the > > result of > > the > > > command. > > > > > > http://www.php.net/manual/en/language.operators.execution.php > > > > On Monday 08 October 2001 04:50 pm, you wrote: > > > Hello Evan, > > > > > > try exec(); > > > > > > /Merle > > > > > > Monday, October 08, 2001, 8:01:41 PM, you wrote: > > > > > > EN> System just executes the script without returning the output. To > > > get the EN> output instead if system("script"); use something like echo > > > script; > > > > > > EN> On Monday 08 October 2001 12:50 pm, you wrote: > > > >> Hi all > > > >> > > > >> I've compiled PHP in module and in CGI mode. > > > >> > > > >> I want to execute a PHP script (shell script) through a PHP page > > > >> like that ... > > > >> > > > >> page.php > > > >> -------------------------- > > > >> <?php > > > >> system("script"); > > > >> ?> > > > >> -------------------------- > > > >> > > > >> > > > >> script > > > >> -------------------------- > > > >> #!/usr/local/bin/php -q > > > >> <?php > > > >> print("test"); > > > >> ?> > > > >> -------------------------- > > > >> > > > >> > > > >> In my page.php nothing appears ... > > > >> (if I remove the -q option, page.php only shows "Content-type: > > text/html > > > > >> ") > > > >> > > > >> > > > >> > > > >> If "script" is written in PERL .... > > > >> > > > >> --------------------------- > > > >> #!/usr/bin/perl > > > >> > > > >> print "test"; > > > >> > > > >> --------------------------- > > > >> > > > >> .... it works perfectly : page.php shows "test" > > > >> (thus it is not a binpath problem) > > > >> > > > >> > > > >> > > > >> Is there something I miss ? > > > >> > > > >> > > > >> TIA > > > >> > > > >> > > > >> ps : could you forward to fxbois@free.fr

« previous php.general (#70551) next »