Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2003
    USA, FL

    php bandwidth usage

    Is there a way to monitor how much bandwidth is used by each user under home with php?

    I had the idea of making a site that people would add $xx amount and then it would take out of that amount according to the space and bandwidth they used each month.

    I am looking into rddtools but it seems to do graphs not the data itself.

  2. #2
    Many control panels have it inbuilt.
    Which one are you using ?
    Its not possible through PHP alone.
    PHP doesnt cover images, txt files, audio and video.
    Softaculous - Auto Installer for cPanel, Direct Admin, InterWorx, Plesk, H-Sphere
    The only Auto Installer that installs 260+ scripts. Install in just ONE STEP!
    Virtualizor - VPS Control Panel supporting OpenVZ, Xen, KVM and has 60+ OS Templates
    Webuzo - Softaculous for the Cloud i.e. Softaculous Standalone

  3. #3
    Join Date
    Mar 2005
    New York City
    You can do it in php, but you would still need to interface it with something else. PHP is unable to retrieve information about the server in most production servers as methods such as "exec" are disabled for [obvious] security reasons.

    Your best bet would be to write a shell script that gathers the information, dumps it into a file (csv, xml, etc...) and the php script just parses that file.

    It's not for the average user on a shared account, but for a server administrator it might be more useful than the standard WHM readouts as the only way to get truly detailed information about an account is to log into that accounts cPanel account and check AWStats or a similar script (which works pretty much the way I mentioned above).
    Matthew Rosenblatt, and I do lots of things.
    Currently a Master Electrician on Broadway.
    My company, BurstAV, specializes in A/V Systems Design and integration.
    I also own ConcertCables. We build power/data cables for the entertainment industry.

  4. #4
    Join Date
    Jan 2003
    USA, FL
    Thank you, that is what I figured I would have to do. I do have a VPS at the moment but will have to figure out how to calculate the bandwidth and space according to the logs.

  5. #5
    Join Date
    Mar 2007
    United Kingdom
    You'd need to parse the access logs from Apache (or other web server), or otherwise the only other way I can think of would be to analyse the traffic as it comes in (a kind of virtual ethernet device): though just for a web server you could potentially do it by a sort of reverse proxy thing (obviously PHP isn't best placed to handle that - you'd need to write something in C or similar I suppose).

    There's a reason why most/all control panels do this by parsing logs, and if you think about how to go about the two options I mentioned I think it's pretty clear
    UK, Chicago, & Singapore Fully Managed Cloud VPS
    UK & Arizona Jelastic Java, PHP & Ruby PaaS

    Comprehensive SLAs, backups, full SSD, rebootless kernel updates.
    Experienced managed hosting provider since 2001. True 24x7 Support & Server Management

Similar Threads

  1. whm/cpanel: counting ftp bandwidth in bandwidth usage
    By chamelion in forum Hosting Security and Technology
    Replies: 7
    Last Post: 02-27-2006, 05:27 AM
  2. Bandwidth graphs - keep track of your bandwidth usage 24x7!
    By farpost in forum Other Offers & Requests
    Replies: 0
    Last Post: 08-08-2005, 11:00 PM
  3. CPanel, View Bandwidth Usage, all account - 0 bandwidth...
    By Jubal in forum Hosting Software and Control Panels
    Replies: 6
    Last Post: 04-05-2005, 01:59 PM
  4. a new era of bandwidth usage
    By Bodeba in forum Running a Web Hosting Business
    Replies: 25
    Last Post: 01-11-2004, 08:56 PM
  5. Bandwidth Usage
    By Hey It's Me in forum Running a Web Hosting Business
    Replies: 6
    Last Post: 05-07-2002, 09:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts