Portal Home > Knowledgebase > Articles Database > WHM reporting way way under actual usage
WHM reporting way way under actual usage
Posted by Mac Write, 05-13-2008, 04:37 PM |
One friend I host sites for is reporting 492MB in WHM, but running DU reports 5.4GB for just one site!!! I've had the DC run Quotafix, but it's still not correct. The site is drupal and DC said they can't even list the tmp folder for that account. Any suggestions so I don't loose $45/month in extra charges? I have no clue how many months this is been going on, but it's costing me allot it seems.
|
Posted by JulesR, 05-13-2008, 08:46 PM |
The reason the space is being reported incorrectly is because PHP is running as the user "nobody", and thus all uploaded files are not counted towards the quota. Quotas only work based on the ownership of the file, and files need to be owned by the user for them to be counted.
The "quick fix" for this issue is to change the ownership of all uploaded files to the user of the home directory they belong to. The downside to this is that in your current configuration, PHP will be unable to delete these files. If you run a gallery for example, this can be a huge problem.
The best way to resolve this issue is to switch from mod_php to using SuPHP within WHM. There are other alternatives but SuPHP appears to be fastest on all benchmarks I've seen. If you run through the EasyApache installer you can select to add SuPHP and then configure it to be active during the final configuration screen. This will make PHP run as the user of the site that's being accessed, instead of "nobody", and your quotas will work correctly with PHP file uploads. After you've made the switched you will then need to change the ownership of the files a single time to modify anything that was uploaded pre-SuPHP phase.
I strongly suggest you do some reading on the "side effects" of moving to SuPHP though, as you may run into some issues (by default) with folders that have global write permissions (777) and PHP misconfigurations within .htaccess files.
Good luck.
|
Posted by Mac Write, 05-13-2008, 09:38 PM |
This seems like a nice loophole for users, just upload files via php and they can avoid the quota.
|
Posted by JulesR, 05-13-2008, 09:59 PM |
Not really a loophole, just a minor mod_php limitation. It's fundamentally a trade-off, performance vs security.
This situation just further illustrates that automated tools are nice and all, but regular manual system administration is still required
|
Posted by Mac Write, 05-13-2008, 10:33 PM |
Security comes first, so which is the most secure option, and can I run DU as a cron at the end of the month, and another script to get MySQL totals and then e-mail them to me?
|
Posted by JulesR, 05-13-2008, 10:49 PM |
Logically speaking SuPHP is more secure, but it's vastly slower due to the fact that PHP doesn't sit in the RAM and must be invoked every instance a script is executed. This in turn means more RAM is required, and also means more disk activity.
With SuPHP you wouldn't need to perform a "du" to check disk usage at the end of the month (unless you're overselling), because the quotas would then be accurate.
Sure, you can get the MySQL database totals e-mailed to you, just write a script with the following command:
That'll give you the MySQL usage, top to bottom.
|
Posted by Mac Write, 05-14-2008, 03:40 AM |
How do I get it e-mailed to myself for MySQL and the Home Dir listen on the first of each month? command line isn't my strength at present.
|
Add to Favourites Print this Article
Also Read