[PHP-DEV] Console Behavior

2002-10-31 Thread Adam Voigt
Is this normal?
I have:

#!/usr/local/php_4.2.3/bin/php -q
?php

error_reporting(E_ALL);

echo \n\nAttach code?  ;

$f = fopen(php://stdin,r);
$data = fread($f,5);
fclose($f);

echo \n\n$data\n\n;

?

And it refuses to echo Attach code? until after
I hit 5 keys on the console and hit enter, when infact
it is supposed to be a prompt for the 5 keys (ie,
display before you enter the keys) Is this expected?
If yes, any workaround?.

Adam Voigt
[EMAIL PROTECTED]




-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Console Behavior

2002-10-31 Thread Rasmus Lerdorf
flush()

On 31 Oct 2002, Adam Voigt wrote:

 Is this normal?
 I have:

 #!/usr/local/php_4.2.3/bin/php -q
 ?php

 error_reporting(E_ALL);

 echo \n\nAttach code?  ;

 $f = fopen(php://stdin,r);
 $data = fread($f,5);
 fclose($f);

 echo \n\n$data\n\n;

 ?

 And it refuses to echo Attach code? until after
 I hit 5 keys on the console and hit enter, when infact
 it is supposed to be a prompt for the 5 keys (ie,
 display before you enter the keys) Is this expected?
 If yes, any workaround?.

 Adam Voigt
 [EMAIL PROTECTED]




 --
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Console Behavior

2002-10-31 Thread Adam Voigt
Now I have this, same behavior as before, maybe I'm using the flush
function incorrectly but the manual seems to suggest this
is the way to use it:

#!/usr/local/php_4.2.3/bin/php -q
?php

error_reporting(E_ALL);

echo \n\nAttach code?  ;

flush();

$f = fopen(php://stdin,r);
$data = fread($f,5);
fclose($f);

echo \n\n$data\n\n;

?

On Thu, 2002-10-31 at 10:21, Rasmus Lerdorf wrote:
 flush()
 


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Console Behavior

2002-10-31 Thread Rasmus Lerdorf
Running your code here gives me:

8:27am thinkpad:~ ./foo


Attach code?  12345


12345


8:27am thinkpad:~

Seems to work fine.

-Rasmus

On 31 Oct 2002, Adam Voigt wrote:

 Now I have this, same behavior as before, maybe I'm using the flush
 function incorrectly but the manual seems to suggest this
 is the way to use it:

 #!/usr/local/php_4.2.3/bin/php -q
 ?php

 error_reporting(E_ALL);

 echo \n\nAttach code?  ;

 flush();

 $f = fopen(php://stdin,r);
 $data = fread($f,5);
 fclose($f);

 echo \n\n$data\n\n;

 ?

 On Thu, 2002-10-31 at 10:21, Rasmus Lerdorf wrote:
  flush()
 



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Console Behavior

2002-10-31 Thread Adam Voigt
You are correct, I tried it on an identical system and it worked.
But it still refuses to work on my other system. They both
run RH8 with PHP 4.2.3, the only difference (that I can see)
is that I'm connecting to the box it doesn't work on through SSH,
I don't have a third box from which to test this theory handy
but it might have something to do with OpenSSH's buffering of
data or something, hmmm.

Anyway, thanks for helping me out, I would have
been banging my head against the wall all day had
I not discovered this discrepancy.

Adam Voigt
[EMAIL PROTECTED]

On Thu, 2002-10-31 at 10:30, Rasmus Lerdorf wrote:
 Running your code here gives me:
 
 8:27am thinkpad:~ ./foo
 
 
 Attach code?  12345
 
 
 12345
 
 
 8:27am thinkpad:~
 
 Seems to work fine.
 
 -Rasmus
 
 On 31 Oct 2002, Adam Voigt wrote:
 
  Now I have this, same behavior as before, maybe I'm using the flush
  function incorrectly but the manual seems to suggest this
  is the way to use it:
 
  #!/usr/local/php_4.2.3/bin/php -q
  ?php
 
  error_reporting(E_ALL);
 
  echo \n\nAttach code?  ;
 
  flush();
 
  $f = fopen(php://stdin,r);
  $data = fread($f,5);
  fclose($f);
 
  echo \n\n$data\n\n;
 
  ?
 
  On Thu, 2002-10-31 at 10:21, Rasmus Lerdorf wrote:
   flush()
  
 
 



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Console Behavior

2002-10-31 Thread Adam Voigt
Figured it out, turns out I had actually bothered to copy the php.ini
from the recommended on the server it didn't work on, if I removed the
config file (forcing PHP to use the default options), it worked fine,
I narrowed the problem down to the output_buffering setting, changing
it from 4096 (probably designed for website hit performance) to 0 made
it work (with or without the call to flush()).

Now my only question is, shouldn't flush() force the buffer to be
sent out despite the config setting?

Adam Voigt
[EMAIL PROTECTED]

On Thu, 2002-10-31 at 10:30, Rasmus Lerdorf wrote:
 Running your code here gives me:
 
 8:27am thinkpad:~ ./foo
 
 
 Attach code?  12345
 
 
 12345
 
 
 8:27am thinkpad:~
 
 Seems to work fine.
 
 -Rasmus



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Console Behavior

2002-10-31 Thread Yasuo Ohgaki
It's known issue...

--
Yasuo Ohgaki

Adam Voigt wrote:
 Figured it out, turns out I had actually bothered to copy the php.ini
 from the recommended on the server it didn't work on, if I removed the
 config file (forcing PHP to use the default options), it worked fine,
 I narrowed the problem down to the output_buffering setting, changing
 it from 4096 (probably designed for website hit performance) to 0 made
 it work (with or without the call to flush()).
 
 Now my only question is, shouldn't flush() force the buffer to be
 sent out despite the config setting?
 
 Adam Voigt
 [EMAIL PROTECTED]
 
 On Thu, 2002-10-31 at 10:30, Rasmus Lerdorf wrote:
 
Running your code here gives me:

8:27am thinkpad:~ ./foo


Attach code?  12345


12345


8:27am thinkpad:~

Seems to work fine.

-Rasmus
 
 
 


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php