Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

How to limit max downloads in apache?

Discussion in 'General Discussion' started by Stouf, Oct 28, 2018.

  1. Stouf

    Stouf Registered

    Joined:
    Oct 28, 2018
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Mara
    cPanel Access Level:
    Root Administrator
    How do you limit the max number of simultaneous downloads at same time and display a too many users error when that limit has been reached in apache?
     
  2. rpvw

    rpvw Well-Known Member

    Joined:
    Jul 18, 2013
    Messages:
    1,088
    Likes Received:
    441
    Trophy Points:
    113
    Location:
    Spain
    cPanel Access Level:
    Root Administrator
    There are probably many ways of achieving this ...... here is one way I would explore if I were trying to solve the problem.....

    Use PHP to create session files for each started download, that were then stored or enumerated in a database (MySQL or SQLite - whatever rocks your world), and counted before allowing a new session (file download) to be started - if the number of sessions is over the set limit -> display "too many users" error.

    Don't forget to delete the session entry when the download finishes.

    Use your favourite search engine to look for "PHP how to count downloads" for ideas and code examples.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    cPanelMichael and Stouf like this.
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    46,968
    Likes Received:
    2,119
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @Stouf,

    Let us know how it turns out.

    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Stouf

    Stouf Registered

    Joined:
    Oct 28, 2018
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Mara
    cPanel Access Level:
    Root Administrator
    What php scripts can do this?
     
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    46,968
    Likes Received:
    2,119
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @Stouf,

    I don't have a specific PHP script to recommend, but there are some limits you can configure for Apache in WHM >> Apache Configuration >> Global Configuration. For instance, Max Request Workers is a value you could adjust:

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice