PHP Apache print is suspended in server side if client just opens connection -


in server side have script file test_print.php:

<?php ini_set("display_errors", 1);  file_put_contents("/home/tmp/debug.txt", "test\n", file_append); $s_long_string = ""; ($i = 0; $i < 10000; $i++) {     $s_long_string .= "abcrc{$i}"; }  echo $s_long_string; echo $s_long_string; echo $s_long_string; echo $s_long_string; echo $s_long_string; echo $s_long_string; echo $s_long_string; echo $s_long_string;  file_put_contents("/home/tmp/debug.txt", "test2\n", file_append); ?> 

and have client script test.php:

<?php $fh = fopen('http://localhost/test_print.php', 'r'); ?> 

if execute script test.php, can see second line in file /home/tmp/debug.txt not added. php code suspended after first print , waits client request content. if content requested, php executed, if not php file not executed. problem that, if in client script added sleep function, php file not executed , waits client action , therefore if there kind of database connection not freed up. looked kind of parameter didn't find it. can repeat strange behavior on windows , on ubuntu. not related buffer cache, because in situation server side script suspended not output.

is faced kind of apache + php behavior , how avoided? understanding when rendering php simble web page, php script should executed not partially.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -