You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PHP 7.2.4中sys_getloadavg()返回false问题求助

Troubleshooting 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, remove sys_getloadavg from the comma-separated list, and save.
  • Or directly edit your php.ini file 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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 10:41:26