View Full Version : getting bandwidth and space used of a subdomain
05-02-2004, 07:17 AM
Cpanel does this. How can I do this with PHP?
05-02-2004, 11:39 AM
you can't , not directly anyway , find out what tools are available on your server and exec() them... e.g.
$yaks = exec( 'du -h /home/user/www/test', $result ) ;
echo implode( "<br />", $result );
05-03-2004, 02:16 AM
?? what do you mean find out what tool and exec them?
what tool am I looking for?
05-03-2004, 03:20 AM
I mean find the appropriate *NIX executable that does what you want to do and use PHP's exec to run it ... a better example.
show disk usage for subdomain .. (most subdomains simply utilise a folder in the www root , check the paths beofre trying !)
$yaks = exec( 'df -h /home/user/www/subdomain', $result ) ;
echo 'disk usage = ' . implode( "<br />", $result );
$yaks = exec( 'df -h /home/mail/subdomain.com', $result ) ;
echo 'mailbox size = ' . implode( "<br />", $result );
as for bandwidth , not a clue how to work that one out , but as noted its not something you can do directly via PHP , try a bit of googleing
errr OK I was wrong about 'not directly' for disk space :o
$df = disk_free_space("/home/user/www/subdomain");
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.