I want to set output_buffering=0 in a single directory. When I create a .user.ini file in that directory with output_buffering=0 , phpinfo() shows 0 for the the local value, and 4096 for the master, but the actual behavior PHP exhibits is as if output_buffering=4096.
In other words, PHP appears to be ignoring the local value and instead using the master value.
Apache is configured to use PHP-FPM with SetHandler, not ProxyPass:
<FilesMatch \.(php|phar)$>
SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
</FilesMatch>
This response should arrive in three chunks, one second apart each - with or without the str_repeat(…) call. In actuality it only does so when str_repeat(…) is uncommented. When I set the master value of output_buffering=0 I get the behavior I want without str_repeat(…), but not when I set the local value.
header('Content-Type: text/text');
for ($i = 0; $i < 3; ++$i) {
echo $i;
// echo str_repeat(' ', 4094);
echo "\n";
flush();
sleep(1);
}
According to the PHP documentation for output_buffering
output_buffering is modifiable per directory.
Interestingly, despite the setting in .user.ini affecting the displayed local value, phpinfo(), does not show .user.ini in "additional .ini files parsed"
ob_get_level()return?print_r(ob_get_status());, it should be empty if php's buffering is off.