"Anthony Borla" <ajborla@bigpond.com> wrote in message
news:KVMJb.76752$aT.51366@news-server.bigpond.net.au...[color=blue]
>
> "Phil Powell" <soazine@erols.com> wrote in message
> news:1cdca2a7.0401031303.6bee67d0@posting.google.c om...[color=green]
> >[/color]
> <SNIP CODE>[color=green]
> >
> > I am writing a very simple PHP script that will be called from a
> > front-end bash script (and a TCL script - long story) that will remove
> > a list of files passed into the PHP script as $argv array. Problem is
> > right now that I am unable to get it to write to the error log (see
> > method writeErr) nor am I able to produce the error in stdout (again
> > see method writeErr), I get the error message:
> >
> > Supplied argument is not a valid File-Resource handle in line 53:
> >
> > line 53: fwrite(STDOUT, $myErr);
> >
> > I am not sure now how to do this so I can use some help.
> >[/color]
>
> Sounds like your're using a PHP version older than 4.3.0 where STDOUT et[/color]
al,[color=blue]
> are not automatically opened. You could do this yourself, using something
> like:
>
> define('STDOUT', fopen("php://stdout", "r"));
> define('STDERR', fopen("php://stderr", "r"));
> ...
>
> See:
>
>
http://www.php.net/manual/en/features.commandline.php
>
> for more details.
>
> I hope this helps.
>
> Anthony Borla
>
>[/color]
Actually none of that worked for me, including define(). The solution was a
bit esoteric and I don't have a technical explanation for it, but in the TCL
script that calls the PHP code I did this
set blah [eval "exec php -q /./fileremoval.php $fileList]
puts $blah
Apparently the TCL script that calls the PHP script might have control of
STDOUT so there was nothing that PHP could do to output its results, so I
simply allowed for any results to go to the TCL script variable $blah that
would be set to whatever the PHP script sends it.
I can't explain it any better than that.
Phil