Try to derive number of cores from /proc/cpuinfo if nproc is not available

This commit is contained in:
DL6ER
2017-02-28 23:51:58 +01:00
parent 107ae02887
commit 220b31a714

View File

@@ -71,6 +71,12 @@
// Get number of processing units available to PHP
// (may be less than the number of online processors)
$nproc = shell_exec('nproc');
if(!is_numeric($nproc))
{
$cpuinfo = file_get_contents('/proc/cpuinfo');
preg_match_all('/^processor/m', $cpuinfo, $matches);
$nproc = count($matches[0]);
}
// Get memory usage
$data = explode("\n", file_get_contents("/proc/meminfo"));