Attachment I/O limit Setting in PHP.INI

Get help with installation and running phpBB 3.1.x here. Please do not post bug reports, feature requests, or extension related questions here.
Scam Warning
Forum rules
READ: Board-Wide Rules and Regulations

NOTE: phpBB 3.1.x is at its End of Life stage and support will NOT be provided after July 1st, 2018.
User avatar
Registered User
Posts: 162
Joined: Wed Aug 03, 2005 12:37 am
Location: Ontario, Canada
Name: Edward

Attachment I/O limit Setting in PHP.INI

Post by Edward572 » Fri Dec 16, 2016 7:05 pm

Hello Everyone,
phpbb forum version: 3.1.10

Max i/o to host disk is 1,024KB/Sec, so if your downloading an attachment from phpbb forum Site hosted at my host your entire site(s) are limited by this disk i/o limitation.
Not quite sure if this is a phpbb question or a PHP.ini or extension request, please move to proper area if in wrong spot.

Large files uploaded past 64MB seem to fail, even with PHP.ini set to higher in root folder. I go in to my c/p and watch the i/o max out when uploading or downloading, and then I think the site throttles down and connection is broken, and when downloading you can continue, but if the file is large, you may need to repeat a few times and get it all.

Not sure if it has a time limit for script in phpbb or PHP.ini or server setting maxes.

With that all in mind is there a way to limit upload or download speeds to stop the connection from maxing out hosts limits, say 512KB/Sec limit stoping the host from breaking the connection? Hopefully something simple...

Thanks in advance.

ADD1: Further reading, limit imposed on entire hosting account, so even if I get one site under the limits, if other sites need disk resources it still may max out and disconnect connection.

So PHP.ini script maybe that has a max say of 896KB/Second Max, leaving 128KB as a top end buffer. Then something that feels the KB usage of all sites and divides the 896KB disk i/o between all sites equally, I kind of QOS, as the connections finish the BW is increased on the Remaing connection, but since host max is never reached the connections stay until download / upload is complete on all sites.

Not sure if this can even be done, I'll keep reading and add if I find anything that helps.


Code: Select all

// change this value below
$cs_conn = mysql_connect('localhost', 'root', '');
mysql_select_db('shareit', $cs_conn);

// local file that should be send to the client
$local_file = $_GET['file'];
// filename that the user gets as default
$download_file = $_GET['file'];

// set the download rate limit (=> 20,5 kb/s)
$download_rate = 85; 
if(file_exists($local_file) && is_file($local_file)) {
    // send headers
    header('Cache-control: private');
    header('Content-Type: application/octet-stream'); 
    header('Content-Length: '.filesize($local_file));
    header('Content-Disposition: filename='.$download_file);

    // flush content
    // open file stream
    $file = fopen($local_file, "r");    
    while(!feof($file)) {

        // send the current file part to the browser
        print fread($file, round($download_rate * 1024));    

        // flush the content to the browser

        // sleep one second

    // close file stream
else {
    die('Error: The file '.$local_file.' does not exist!');

if ($dl) {
} else {
    header('HTTP/1.0 503 Service Unavailable');
    die('Abort, you reached your download limit for this file.');
Cheers All, Have A Good One

Bacon is the greatest food, but someone said no, "Chocolate"
Forum StormerSoft.Com


Return to “[3.1.x] Support Forum”