Copy and paste this code into the page you want to show disk information for your web server:
<p> <?php // set partition $fs = "/"; // display available and used space echo "Total available space on this partition: " . round(disk_total_space($fs) / (1024*1024)) . " MB\r\n<br />"; echo "Total free space: " . round(disk_free_space($fs) / (1024*1024)) . " MB\r\n<br />"; // calculate used space $disk_used_space = round((disk_total_space($fs) - disk_free_space($fs)) / (1024*1024)); echo "Total used space: " . $disk_used_space . " MB\r\n<br />"; // calculate % used space echo "% used space: " . round((disk_total_space($fs) - disk_free_space($fs)) / disk_total_space($fs) * 100) . " %"; ?> </p>
That should produce something like this:
Total available space on this partition: 38195 MB
Total free space: 18464 MB
Total used space: 19731 MB
% used space: 52 %