Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    getting bandwidth and space used of a subdomain

    Cpanel does this. How can I do this with PHP?

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,073
    Thanks
    11
    Thanked 98 Times in 96 Posts
    you can't , not directly anyway , find out what tools are available on your server and exec() them... e.g.

    PHP Code:
    <?
    $yaks 
    exec'du -h /home/user/www/test'$result ) ;
    echo 
    implode"<br />"$result );
    ?>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #3
    New Coder
    Join Date
    Apr 2004
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ?? what do you mean find out what tool and exec them?
    what tool am I looking for?

  • #4
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,073
    Thanks
    11
    Thanked 98 Times in 96 Posts
    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 !)
    PHP Code:
    <?
    $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
    PHP Code:
    <?
    $df 
    disk_free_space("/home/user/www/subdomain"); 
    ?>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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