How to find disk space using php?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rajsekar2u
Forum Commoner
Posts: 71
Joined: Thu Nov 20, 2008 4:23 am

How to find disk space using php?

Post by rajsekar2u »

Hi all,
Is there any way to find disk space usage using php in server side.
disk_total_space() By this i can able find the space in local.
How to find in server side .

Thanks in advance
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: How to find disk space using php?

Post by Mark Baker »

disk_total_space() By this i can able find the space in local.
What makes you think disk_total_space() returns the space on a local/client drive rather than on the server?

Code: Select all

$disk_used_space = disk_total_space('/') - disk_free_space('/');
rajsekar2u
Forum Commoner
Posts: 71
Joined: Thu Nov 20, 2008 4:23 am

Re: How to find disk space using php?

Post by rajsekar2u »

it showing me error:

Warning: disk_free_space() [function.disk-free-space]: open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/sanssan:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/sanssan/public_html/test.php on line 6
Post Reply