Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the space available of web server in php?

Tags:

php

I have a domain name like 'mydomain.com'. I want to check how much space available on server with this domain name with the help of php. Like for our hard drive we use disk_total_space("C:");. Can anyone help me to get the solution.

like image 950
Amit Kumar Avatar asked Dec 06 '12 11:12

Amit Kumar


2 Answers

Depending on the structure of the file system you can use something like the following for Linux hosts:

$df = round(disk_free_space("/var/www") / 1024 / 1024 / 1024);
print("Free space: $df GB");

Or in your case it sounds like you're running on Windows so:

$df = round(disk_free_space("C:") / 1024 / 1024 / 1024);
print("Free space: $df GB");
like image 196
PeterJ Avatar answered Oct 05 '22 16:10

PeterJ


The main function is used to get space available is same as above said. you have to use disk_free_space(). but the different is to know the server path. And put it in braces.

like image 25
Prem Avatar answered Oct 05 '22 16:10

Prem