|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2004-01-08 20:35 UTC] iliaa@php.net
  [2008-07-05 21:41 UTC] dazjorz at dazjorz dot com
  [2008-07-11 21:16 UTC] jani@php.net
 | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 18:00:01 2025 UTC | 
Description: ------------ code shell> ./test.php don't press CTRL+D to end input. but program exists in 3 seconds because feof() return true uncomment line 7 will works ok, exit only when i press CTRL+D Reproduce code: --------------- file ./test.php: #!/usr/bin/php <?php function sig_handler($signo) { global $stdin; print "Caught SIGALM...\n"; pcntl_alarm(3); // line7 // $stdin = fopen("php://stdin", 'r') or die('1'); } print "Installing signal handler...\n"; pcntl_signal(SIGALRM, "sig_handler"); print "Generating signal SIGTERM to self...\n"; declare(ticks=1); pcntl_alarm(3); $stdin = fopen("php://stdin", 'r') or die('1'); while (!feof($stdin)) { echo fgets($stdin); } print "Done\n" ?>