|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-07-01 15:15 UTC] sander@php.net
[2002-08-23 22:03 UTC] sniper@php.net
[2002-08-23 22:05 UTC] sniper@php.net
[2002-08-24 05:55 UTC] wez@php.net
[2002-08-25 07:04 UTC] wez@php.net
[2002-09-21 02:02 UTC] sniper@php.net
[2002-09-24 16:12 UTC] wez@php.net
[2002-09-25 09:30 UTC] wez@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 09:00:01 2025 UTC |
This used to work in PHP 4.0.6: cat test.txt| php -q stdin.php DEBUG: I have line one DEBUG: I have line two DEBUG: I have line three DEBUG: I have line four DEBUG: I have line five DEBUG: I have line six DEBUG: done stdin.php --------- <?php $fp = fopen('php://stdin','r'); while(!feof($fp)) { $line = fgets($fp,4096); echo "DEBUG: I have line $line"; } fclose($fp); echo "DEBUG: done\n"; ?> Now in PHP 4.2.1, it does not work, it only prints the first line of the input. I tried setting allow_url_fopen = On but that did not make a difference. This DOES work however: <?php $fp = popen('cat /dev/fd/0','r'); while(!feof($fp)) { $line = fgets($fp,4096); echo "DEBUG: I have line $line"; } pclose($fp); echo "DEBUG: done\n"; ?> Here is a entry from the mailing list that may be of help. http://marc.theaimsgroup.com/?l=php-general&m=101428004729977&w=2