Jump to content

[SOLVED] APACHE config issue? Can't move pages when PHP script running


DanR

Recommended Posts

Hey there guys.

 

Basically I am running a PHP script that reads a file from outside of wwwroot to deliver it to the browser, however, when this script is running and the download is in progress that particular visitor cannot change pages or download anything else until the browser is complete, the site becomes inaccessible virtually and just shows a progress bar until the download is finished, and once that's done the site works.

 

The script I am using is the following readfile chunked

 

function readfile_chunked($filename,$retbytes=true) {
   $chunksize = 1*(1024*1024); // how many bytes per chunk
   $buffer = '';
   $cnt =0;
   // $handle = fopen($filename, 'rb');
   $handle = fopen($filename, 'rb');
   if ($handle === false) {
       return false;
   }
   while (!feof($handle)) {
       $buffer = fread($handle, $chunksize);
       echo $buffer;
       ob_flush();
       flush();
       if ($retbytes) {
           $cnt += strlen($buffer);
       }
   }
       $status = fclose($handle);
   if ($retbytes && $status) {
       return $cnt; // return num. bytes delivered like readfile() does.
   }
   return $status;

} [

 

I really don't know where this problem is coming from, I've tried altering PHP output buffering and tweaking a few settings in my apache2 conf.

 

I initially thought the PHP output buffering could possibly be affecting the complete visitor session, but after a little tweaking this doesn't appear to be the case.

 

I'm running PHP 5.1.x with Apache 2.0 on an Ubuntu operating system.

 

Any suggestions or anyone encountered this problem before?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.