[Solved] Can't disable PHP ouput buffering
Added by fab7 almost 8 years ago
Hello,
I have a problem with Lighttpd 1.4.45 on Debian testing.
BUT, I think this is very important, I haven't any problem with Lighttpd 1.4.35 on Debian testing.
With Lighttpd 1.4.45, the following PHP script use output buffering.
=> the result is sent to the browser in one time :(
With Lighttpd 1.4.35, the following PHP script doesn't use output buffering.
=> the result is sent to the browser in 5 times :)
<?php
header('Content-Encoding: chunked');
header('Content-Type: text/plain; charset=utf-8');
header('Cache-Control: no-cache, must-revalidate');
ini_set('output_buffering', false);
ini_set('implicit_flush', true);
ob_implicit_flush(true);
for ($i = 0; $i < ob_get_level(); $i++)
ob_end_clean();
echo "a\n";
flush();
sleep(1);
echo "b\n";
flush();
sleep(1);
echo "c\n";
flush();
sleep(1);
echo "d\n";
flush();
sleep(1);
echo "e\n";
flush();
Why? I don't understand.
--
The 15-fascgi-php.conf:
server.modules += ( "mod_fastcgi" ) fastcgi.server += ( ".php" => (( "bin-path" => "/usr/bin/php-cgi", "socket" => "/tmp/php.socket", "max-procs" => 1, "bin-environment" => ( "PHP_FCGI_CHILDREN" => "2", "PHP_FCGI_MAX_REQUESTS" => "10000" ), "bin-copy-environment" => ( "PATH", "SHELL", "USER" ), "broken-scriptfilename" => "enable" )) )
The lighttpd.conf:
server.modules = ( "mod_auth", "mod_access", "mod_alias", "mod_expire", "mod_rewrite", "mod_redirect", "mod_setenv" ) server.errorlog = "/var/log/lighttpd/error.log" server.pid-file = "/var/run/lighttpd.pid" server.username = "fabrice" server.groupname = "fabrice" server.use-ipv6 = "enable" server.document-root = "/var/www/" server.errorfile-prefix = "/home/fabrice/config-admin/error/" mimetype.use-xattr = "enable" index-file.names = ( "index.php", "index.html" ) url.access-deny = ( "~", ".inc", ".pl", ".sh", ".bak", ".old" ) static-file.exclude-extensions = ( ".php" ) server.dir-listing = "enable" dir-listing.encoding = "utf-8" dir-listing.show-readme = "enable" dir-listing.hide-readme-file = "enable" dir-listing.hide-dotfiles = "enable" include_shell "/usr/share/lighttpd/create-mime.assign.pl" include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
Replies (1)
RE: Can't disable PHP ouput buffering - Added by gstrauss almost 8 years ago
Just as important as your mention that it worked in lighttpd 1.4.35: maybe you can benefit from reading the doc about changes in lighttpd 1.4.36-1.4.45 before you post?
With lighttpd 1.4.40, released July 2016, the default is to buffer output.
You can change this with the configuration directive server.stream-response-body