I'm trying to debug some code I haven't been in for years. It's in the 1and1
linux hosting environment.
Under
PHP 4.4.8 (cgi) (built: Mar 6 2008 18:09:06)
This code
<?php
fwrite(STDOUT, "trythis\r\ n");
?>
executed thusly:
does nothing.
Under
PHP 5.2.5 (cgi) (built: Apr 25 2008 14:13:32)
This code
<?php
fwrite(STDOUT, "trythis\r\ n");
?>
executed thusly:
Produces:
<br />
<b>Warning</b>: fwrite(): supplied argument is not a valid stream resource
in <b......./trythis.php</bon line <b>2</b><br />
Apparently I must now do something looking like this:
<?php
$STDOUT = fopen('php://stdout', 'w');
fwrite($STDOUT, "trythis\r\ n");
?>
Did I miss something along the way??!? Is this because it's (cgi)? How do I
coerce it to run (cli)???
Thanks for any thoughts!
linux hosting environment.
Under
php -v
This code
<?php
fwrite(STDOUT, "trythis\r\ n");
?>
executed thusly:
php -f trythis.php
Under
php5 -v
This code
<?php
fwrite(STDOUT, "trythis\r\ n");
?>
executed thusly:
php5 -f trythis.php
<br />
<b>Warning</b>: fwrite(): supplied argument is not a valid stream resource
in <b......./trythis.php</bon line <b>2</b><br />
Apparently I must now do something looking like this:
<?php
$STDOUT = fopen('php://stdout', 'w');
fwrite($STDOUT, "trythis\r\ n");
?>
Did I miss something along the way??!? Is this because it's (cgi)? How do I
coerce it to run (cli)???
Thanks for any thoughts!
Comment