Return User Quota with PHP from Linux

I need to know the quota data for the current user,

I tried exec ("quota 'username'", $ retParam) as well as system () but nothing is returned.

Any ideas?

Thank.

+3
source share
1 answer

The user running PHP is probably not allowed to get quotas from other users — perhaps not even his own, or perhaps not even allowed to execute external commands. Depending on the server setting, you can change the PHP configuration (for example, remove safe_mode) and increase the user rights of PHP, but I do not know if this should be done. If you are on a shared hosting, you will have to talk with your provider if anything can be done.

This blog post describes a smart way to get around PHP restrictions by collecting all quotas in a text file in an external cron job and parsing that file using PHP. It only works if you have access to the server, of course, or you can configure cron jobs with more liberal permissions than a PHP user.

+2
source

Source: https://habr.com/ru/post/1733662/


All Articles