Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been trying to flush the output of certain scripts to the browser on demand, but they do not work on our production server.

For instance, I tried running the "Phoca Changing Collation tool" (find it on Google) and I don't see any output until the script finishes executing.

I've tried immediately flushing the buffer on other scripts that work fine on any server but this one using the following code:

echo "something";

Setting "ob_implicit_flush(1);" doesn't help either.

The server is Apache 2.2.21 with PHP 5.2.17 running on Linux. You can see our php.ini file here if that will help:

This isn't the only problem we are having with the server ignoring in-script directives. The server also ignores timeout coding such as:

ini_set('max_execution_time', 900*60);



Script always times out at the php.ini default.

Doesn't seem to matter if script is executed in IE or Firefox.

Tried "ini_set('zlib.output_compression_level', 'Off');" and checked that it is "Off" in the php.ini file. The code "apache_setenv('no-gzip', 1);" causes a fatal error so tried uploading a .htaccess file with the "mod_gzip_on No" directive. Neither helps.

Tried running Apache as fcgi and suphp, but same results.

Server is NOT in safe mode.

Pullin ma hair out!

share|improve this question
I've solved half of this. By adding "SetEnv no-gzip dont-vary" to a .htaccess file in the script's directory, I can get it to flush the buffer correctly. However, I still can't get the scripts to run long enough without timing out on the php.ini default. Max execution time is still ignored. Any ideas? – eComEvo Jul 5 '12 at 3:47
up vote 0 down vote accepted

To fix the output buffer problem, I needed to turn off gzip compression inside the .htaccess file.

To fix the timeout issue, I checked my Apache log files and found it wasn't PHP but in the Apache configuration: The timeout specified has expired: ap_content_length_filter: apr_bucket_read() failed

Had to increase the Apache timeout to prevent this problem. This apparently arises from Apache waiting for more content to hit the buffer before the timeout resets.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.