fix: Errors with missing posix extension (#7666)

* fix: errors with missing posix extension
It should be an optional dependency

* add php71w-process to the CentOS 7 install docs
This commit is contained in:
Tony Murray
2017-11-10 09:20:47 -06:00
committed by Neil Lathwood
parent 301af24ace
commit b79d106c56
6 changed files with 21 additions and 9 deletions

View File

@@ -197,7 +197,10 @@ class Proc
if (!$closed) {
// try harder
$killed = false;
if (function_exists('posix_kill')) {
$killed = posix_kill($status['pid'], 9); //9 is the SIGKILL signal
}
proc_close($this->_process);
if (!$killed && $this->isRunning()) {

View File

@@ -65,6 +65,13 @@ class Php implements ValidationGroup
$validator->fail("Missing CLI PHP extension: $extension", "Please install $extension");
}
}
$suggested_extensions = array('posix' => 'php-process');
foreach ($suggested_extensions as $extension => $packages) {
if (!extension_loaded($extension)) {
$validator->warn("Missing optional PHP extension: $extension", "It is suggested you install $packages or the one that matches your php version");
}
}
}
private function checkFunctions(Validator $validator)

View File

@@ -49,7 +49,7 @@ class User implements ValidationGroup
if (isCli()) {
$validator->fail('You need to run this script as root' .
(Config::has('user') ? ' or ' . $lnms_username : ''));
} else {
} elseif (function_exists('posix_getgrnam')) {
$lnms_group = posix_getgrnam($lnms_groupname);
if (!in_array($username, $lnms_group['members'])) {
$validator->fail(

View File

@@ -7,7 +7,7 @@ source: Installation/Installation-CentOS-7-Apache.md
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install cronie fping git httpd ImageMagick jwhois mariadb mariadb-server mtr MySQL-python net-snmp net-snmp-utils nmap php71w php71w-cli php71w-common php71w-curl php71w-gd php71w-mcrypt php71w-mysql php71w-snmp php71w-xml php71w-zip python-memcached rrdtool
yum install cronie fping git httpd ImageMagick jwhois mariadb mariadb-server mtr MySQL-python net-snmp net-snmp-utils nmap php71w php71w-cli php71w-common php71w-curl php71w-gd php71w-mcrypt php71w-mysql php71w-process php71w-snmp php71w-xml php71w-zip python-memcached rrdtool
#### Add librenms user

View File

@@ -7,7 +7,7 @@ source: Installation/Installation-CentOS-7-Nginx.md
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install cronie fping git ImageMagick jwhois mariadb mariadb-server mtr MySQL-python net-snmp net-snmp-utils nginx nmap php71w php71w-cli php71w-common php71w-curl php71w-fpm php71w-gd php71w-mcrypt php71w-mysql php71w-snmp php71w-xml php71w-zip python-memcached rrdtool
yum install cronie fping git ImageMagick jwhois mariadb mariadb-server mtr MySQL-python net-snmp net-snmp-utils nginx nmap php71w php71w-cli php71w-common php71w-curl php71w-fpm php71w-gd php71w-mcrypt php71w-mysql php71w-process php71w-snmp php71w-xml php71w-zip python-memcached rrdtool
#### Add librenms user

View File

@@ -201,6 +201,7 @@ if (is_writable(session_save_path() === '' ? '/tmp' : session_save_path())) {
echo "<tr class='$row_class'><td>Session directory writable</td><td>$status</td><td>";
if ($status == 'no') {
echo session_save_path() . " is not writable";
if (function_exists('posix_getgrgid')) {
$group_info = posix_getgrgid(filegroup(session_save_path()));
if ($group_info['gid'] !== 0) { // don't suggest adding users to the root group
$group = $group_info['name'];
@@ -208,6 +209,7 @@ if ($status == 'no') {
echo ", suggested fix <strong>usermod -a -G $group $user</strong>";
}
}
}
echo "</td></tr>";
?>
</table>