0

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"

27
  • 1
    So may be your question is just php ignores .user.ini? Commented Mar 17 at 19:54
  • 1
    And which actual sapi it is? FPM or FastCGI? Commented Mar 17 at 20:59
  • 1
    So it's your answer. php-fpm doesn't support user ini Commented Mar 18 at 6:10
  • 1
    What makes you think that PHP uses output buffering? What does ob_get_level() return? Commented Mar 18 at 7:51
  • 1
    Which module are you using? It is possible that you have set different buffering options for different directories/locations in Apache. Additionally, did you directly access the PHP file in the directory or did you access it through another PHP file? And try print_r(ob_get_status());, it should be empty if php's buffering is off. Commented Mar 19 at 7:32

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.