Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Im a php developer and I would like to offer subdomain hosting,but need also to be able to calculate bandwidth for each subdomain.

For the subdomains creation I will use catch-all and wildcards etc to easily set these up.

The one thing im a bit stumped on is how to calculate bandwidth for each subdomain, is this possible within php? or are there better solutions for this perhaps using folders or something?

Also a script will be loaded under the subdomain, this will vary per user. Is it worth giving each user a new folder and their own script, or more easy to manage one script for all users? Any considerations here?

Cheers

Ke

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Your best bet may be to parse out the data transfer from the web server's log files. Whether each subdomain has its own log file or not shouldn't be important as long as there is some way to differentiate them (log the hostname of the request, for example). You can then aggregate the statistics and act on it accordingly. This will have the added benefit of tracking bandwidth used by page assets as well (javascript, css, images, etc.).

share|improve this answer
    
awesome answer, perfect, just what im looking for, thanks Justin :) –  Ke. Jun 9 '10 at 21:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.