Re: [PHP] CLI script & exec() - how to control what gets dumped on the screen.



Edward Kay wrote:
As a check, does 'apache2ctl graceful' actually output anything to STDOUT? I

well apparently the 'Syntax OK' message is output by apache2ctl to STD_ERR;
which is weird if you ask me - not what I would expect (how in any way
is 'Syntax OK' an error?)

oh well I guess I have a lot to learn and the *nix command line :-)

thanks for your feedback!

would expect your exec commands to work - try with something like 'ls' or
'whoami' and see if you get any results that way.

Edward

I have been trying to figure out how to use exec to run some commandline
scripts (some perl scripts & mysql in this case) WITH the output
of the commands
run via exec being shown on the screen.

neither of these examples have the desired effect:

$output = array(); $exit = 0;
exec('apache2ctl graceful', $output, $exit);


$output = array(); $exit = 0;
@exec('apache2ctl graceful', $output, $exit);

please someone tell me there is a decent way to do this (something
to do with STD input/output redirection or something?) and that
I'm not left
with trying something like:

ob_start();
$output = array(); $exit1 = $exit2 = 0;
@exec('apache2ctl graceful', $output, $exit1);
ob_end_clean();

... of which I don't even know if it would work.

anyone care to share their clue?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




.



Relevant Pages

  • Re: Perl like "warnings"
    ... > When I write Perl scripts I can do a syntax check from the command line ... > I did wrong in writing that script. ...
    (comp.lang.tcl)
  • Re: Perl like "warnings"
    ... >>When I write Perl scripts I can do a syntax check from the command line ... > perl syntax is more complex than Tcl syntax, ... bracket, quote, parentheiss) balanced. ...
    (comp.lang.tcl)
  • Perl like "warnings"
    ... When I write Perl scripts I can do a syntax check from the command line ... using "perl -cw script.pl" and it will tell me all sorts of stuff that ...
    (comp.lang.tcl)