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
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.
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