You are using a browser which is not compatible with CSS (for more information, see Tara's tutorial). Because of this, it is possible that our website may not appear correctly in your browser. We apologise for the inconvenience, and recommend you upgrade your browser to one which is compatible with CSS. For more information, please visit our Browser Upgrade page.

4WebHelp

Scripts: PHP: Used Space

This script will output the amount space which is being used by your site. It may not work on servers where PHP is running in safe mode.

<?php

###########################################################################
#                                                                         #
# Copyright © http://www.4webhelp.net/                                    #
# Neither http://www.4webhelp.net/ nor its members accept any             #
# responsibility, either expressed or implied, for any damage caused by   #
# using this script or the misuse of this script.                         #
#                                                                         #
#                                                                         #
#                          INSTRUCTIONS                                   #
#                                                                         #
# 1) Copy this code to an editor such as Notepad and save it with a       #
# .php  extension.                                                        #
# 2) FTP this file to a folder on your site in ASCII mode                 #
# 3) Replace $home_dir with the path to your home directory - ask in our  #
# forums if you don't know what it is.                                    #
# 4) Call up this file in your web browser to see your used space         #
#                                                                         #
###########################################################################

// Please replace this with the path to your home directory

$home_dir='/path/to/your/home/directory/';

// This actually runs the command required to find out how much space is being used
exec('du -s '.$home_dir, $output);
$space = split(" ", $output[0]);

// This converts the number into megabytes and outputs it
$space = $space[0] / 2048;
print ('Space currently being used in '.$home_dir.': <b>'.$space.' Mb</b>');
?> <p>This script courtesy of <a href="http://www.4webhelp.net/">4WebHelp</a>.</p>
Latest comments
rosel
Thank you very interesting.
David Kittell
Slight changes can make this work better

Take a look at http://msdllp.com/code/php/directorysize.php
Gloria
It didn't work, and my safe mode is all good.
Ciaran
Very helpful thanks!

Add a new comment

This page is © Copyright 2002-2017, 4WebHelp. It may not be reproduced without 4WebHelp's prior permission.