Outsourcing software development is one of the logical decisions for many companies. The key point is finding reliable offshore vendor to work with. Being an experienced company in outsourcing software development, Belitsoft guarantees effective collaboration.
Getcomponent is professional asp .net component development vendor GetComponent is a new ASP .NET component development vendor brand specializing in design and development of user interface (UI) and data visualization application for the Microsoft ASP.NET platform. ASP .NET component development is something we know everything about and we are ready to share this knowledge with our customers.
Web parts for SharePoint

Joomla extensions, Joomla components, Joomla modules, Joomla templates

 
   
 
  
You currently
have 0 item(s)

in your shopping cart.
Who's Online
We have 115 guests and 9 members online

Support
Welcome, Guest
Please Login or Register.    Lost Password?
PHP Memory limit & large file size (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: PHP Memory limit & large file size
#1467
mgrick (User)
Fresh Boarder
Posts: 9
graphgraph
User Offline Click here to see the profile of this user
PHP Memory limit & large file size 2 Years, 1 Month ago Karma: 0  
The current code in this component is limited when downloading large files (over 20mb).
Many servers are using the PHP memory limit set to aprox 15 to 25 mb which effectively limits the size of the download.
The current code using "readfile" will load all of the file into memory vs say "readfile_chunked" which passes only the chunk size into memory and then flushes the memory to load another chunk.
Currently the Virtuemart native download code uses this method. Also what ever Docman is using is also working to avoid this download limitation.

Code:

<?php 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 have had to use an htaccess hack as a workaround for this code limitation. My issue is that using the hack works for one or two downloads BUT, given 30 to 50 downloads at the same time will cause a memory problen in PHP. This is why the PHP memory limit is in place...to protect it from scripts using all its memory up and therefore disabling its normal operation. Please take this as a suggestion for your next version to make this code compatible both with the Virtuemart downlaod code and also as a great stand alone component. Thank-you for your support... Rick
 
Logged Logged  
  The administrator has disabled public write access.
      Topics Author Date
    thread link
PHP Memory limit & large file size
mgrick 2006/11/20 14:10
    thread link
thread linkthread link Re:PHP Memory limit & large file size
Vladimir 2006/11/21 04:38
    thread link
thread linkthread linkthread link Re:PHP Memory limit & large file size
djmweb 2008/05/15 16:26
    thread link
thread linkthread linkthread linkthread link Re:PHP Memory limit & large file size
Ann 2008/05/15 17:19
    thread link
thread linkthread linkthread linkthread linkthread link Re:PHP Memory limit & large file size
djmweb 2008/05/16 08:06
    thread link
thread linkthread linkthread linkthread linkthread linkthread link Re:PHP Memory limit & large file size
Ann 2008/05/16 13:15
    thread link
thread linkthread link Re:PHP Memory limit & large file size
djmweb 2008/05/18 19:57
    thread link
thread linkthread linkthread link Re:PHP Memory limit & large file size
Ann 2008/05/19 12:29
    thread link
thread linkthread link Re:PHP Memory limit & large file size
djmweb 2008/05/19 16:01
    thread link
thread linkthread linkthread link Re:PHP Memory limit & large file size
Ann 2008/05/20 15:11
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop