Jump to content

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


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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.