You are here: Re: Which PHP am I running? « PHP Programming Language « IT news, forums, messages
Re: Which PHP am I running?

Posted by Andy Hassall on 12/17/92 11:52

On 10 Jul 2006 13:25:00 -0700, "Chung Leong" <chernyshevsky@hotmail.com> wrote:

>Richard Levasseur wrote:
>> It would seem you're out of luck, then, at least for windows. In *nix
>> you might be able to use the "_" env variable. You can always require
>> a command line switch to be set to specify the mode. The only other
>> idea i have is to figure out where stdout is going.
>
>Hmmm, that should work. GUI apps on Windows have null stdout. An
>attempt to write to it would fail:
>
>$stdout = fopen("php://stdout", "wb");
>
>if(@fwrite($stdout, "Error: the dingo ate my baby\n") == 0) {
> // do something else
>}

Unfortunately not; stdout is still writable, but it's just discarded - similar
to redirecting to /dev/null on Unix.

C:\tmp>type dingo.php
<?php
$stdout = fopen("php://stdout", "wb");
$fp = fopen("out.txt", "wb");

fwrite($fp, $stdout . "\n");

if(@fwrite($stdout, "Error: the dingo ate my baby\n") == 0) {
fwrite("out.txt", "error branch\n");
// do something else
}
?>

C:\tmp>php-win.exe dingo.php

C:\tmp>type out.txt
Resource id #5

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация