Search code examples
phpsystemmemory-management

How to get system info in PHP?


I want to get the system memory usage (and also HDD space info) in PHP. Is there any way to do without invoking commands using system calls?

Note: I am not looking for the script memory usage, but the system memory usage.


Solution

  • On Linux, you can read /proc/meminfo to get information on total and available system memory (just cat /proc/meminfo -- it's a simple text file you can easily parse).

    I'm not sure you can get filesystem information from procfs, by try looking at /proc/sys/fs for interesting information.