Re: Re[2]: [PHP] executing a PHP (shell script) through PHP (module)
| From: | Evan Nemerson | Date: | Tue, 09 Oct 2001 02:06: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-70409@lists.php.net to get a copy of this message | ||
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