PHP 7.2.4中sys_getloadavg()返回false问题求助
sys_getloadavg() Returning False on SiteGround Dedicated Server (PHP 7.2.4) Hey there, I’ve run into similar quirks with SiteGround server configurations before, so let’s break down the most likely fixes for your issue:
1. Check if the function is disabled in PHP config
First up, let’s confirm if sys_getloadavg has been blocked via PHP’s disable_functions directive. Create a quick test script to check this:
<?php echo "Disabled functions: " . ini_get('disable_functions'); ?>
If you see sys_getloadavg in the output, you’ll need to remove it from the disabled list. On SiteGround, you can do this via:
- cPanel’s PHP Selector > Options tab: Find
disable_functions, removesys_getloadavgfrom the comma-separated list, and save. - Or directly edit your
php.inifile if you have access to it on your dedicated server.
2. Switch to PHP-FPM execution mode
CGI/FastCGI mode on SiteGround can sometimes restrict access to system-level functions like sys_getloadavg() due to permission limits. Try switching to PHP-FPM:
- Head to cPanel > PHP Selector > Mode tab.
- Select PHP-FPM and save your changes.
- Test your
sys_getloadavg()call again after the mode switch.
3. Verify server file permissions (dedicated server users)
On Linux systems, system load data lives in /proc/loadavg. Make sure the PHP process user has permission to read this file. Run this command via SSH (replace php-process-user with your actual PHP user, e.g., your cPanel username or nobody):
sudo -u php-process-user cat /proc/loadavg
If this throws a permission error, you may need to adjust file permissions or add the PHP user to the appropriate group. If you’re unsure about server-level permission changes, SiteGround’s dedicated support team can help with this.
4. Consider upgrading PHP
PHP 7.2.4 is end-of-life (no security updates or bug fixes). Upgrading to a supported version like PHP 7.4 or 8.x often resolves compatibility issues with system functions. SiteGround makes this easy via cPanel’s PHP Selector—just pick a newer version and save.
If none of these steps work, reaching out to SiteGround’s dedicated server support is your best bet. They have direct access to your server’s environment and can debug deeper configuration blocks that might be causing sys_getloadavg() to fail.
内容的提问来源于stack exchange,提问作者Big Scott

