From 6e27d888c38d3ca5c263bea8b443eee64e7847b0 Mon Sep 17 00:00:00 2001 From: "Mohammad H. Al-Shami" Date: Sun, 10 May 2015 16:40:38 +0300 Subject: [PATCH 1/4] Update install.php to prevent creating an empty config.php file I agree to the conditions of the Contributor Agreement contained in doc/General/Contributing.md. --- AUTHORS.md | 3 +-- html/install.php | 10 +++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index ab2098623..c547763ae 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -23,7 +23,6 @@ Contributors to LibreNMS: - Stuart Henderson (sthen) - Filippo Giunchedi (filippog) - Lasse Leegaard (lasseleegaard) +- Mohammad Al-Shami (mohshami) [1]: http://observium.org/ "Observium web site" - - diff --git a/html/install.php b/html/install.php index 3f9d31984..2c9b71743 100644 --- a/html/install.php +++ b/html/install.php @@ -33,7 +33,7 @@ include("../includes/defaults.inc.php"); // Work out the install directory $cur_dir = explode('/',$_SERVER['DOCUMENT_ROOT']); $install_dir = array_pop($cur_dir); -$install_dir = array_pop($cur_dir); +#$install_dir = array_pop($cur_dir); $install_dir = implode('/',$cur_dir); $config['install_dir'] = $install_dir; $config['log_dir'] = $install_dir.'/logs'; @@ -344,7 +344,7 @@ require('../build-base.php'); - +
@@ -409,9 +409,9 @@ EOD; if(!file_exists("../config.php")) { $conf = fopen("../config.php", 'w'); - if ($conf === false) + if ($conf != false) { - if(fwrite($handle, 'We couldn't create the config.php file, please create this manually before continuing by copying the below into a config.php in the root directory of your install (typically /opt/librenms/)"); echo("
<?php\n".stripslashes($config_file)."
"); @@ -419,7 +419,7 @@ EOD; else { $config_file = stripslashes($config_file); - fwrite($handle,$config_file); + fwrite($conf,$config_file); echo("
The config file has been created
"); } } From ed0218dba790f7350a0ee521e7db7983dbe9b7fc Mon Sep 17 00:00:00 2001 From: Mohammad Al-Shami Date: Mon, 11 May 2015 00:09:14 +0300 Subject: [PATCH 2/4] Uncommented second $install_dir = array_pop($cur_dir); line. Issue was happening because nginx doesn't add a trailing slash to DOCUMENT_ROOT. Simple change to nginx configuration adds that so no need to edit the code here. Fixed conflict with AUTHORS.md --- AUTHORS.md | 1 + html/install.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/AUTHORS.md b/AUTHORS.md index c547763ae..44232fb13 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -23,6 +23,7 @@ Contributors to LibreNMS: - Stuart Henderson (sthen) - Filippo Giunchedi (filippog) - Lasse Leegaard (lasseleegaard) +- Mickael Marchand (mmarchand) - Mohammad Al-Shami (mohshami) [1]: http://observium.org/ "Observium web site" diff --git a/html/install.php b/html/install.php index 2c9b71743..09ff7922f 100644 --- a/html/install.php +++ b/html/install.php @@ -33,7 +33,7 @@ include("../includes/defaults.inc.php"); // Work out the install directory $cur_dir = explode('/',$_SERVER['DOCUMENT_ROOT']); $install_dir = array_pop($cur_dir); -#$install_dir = array_pop($cur_dir); +$install_dir = array_pop($cur_dir); $install_dir = implode('/',$cur_dir); $config['install_dir'] = $install_dir; $config['log_dir'] = $install_dir.'/logs'; From bdca04563c722c689b072ad96d81751e83782195 Mon Sep 17 00:00:00 2001 From: Mohammad Al-Shami Date: Mon, 11 May 2015 00:48:38 +0300 Subject: [PATCH 3/4] Add logic to handle the case where config.php cannot be written for some reason --- html/install.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/html/install.php b/html/install.php index 09ff7922f..1c625fc00 100644 --- a/html/install.php +++ b/html/install.php @@ -422,6 +422,9 @@ EOD; fwrite($conf,$config_file); echo("
The config file has been created
"); } + } else { + echo("
We couldn't create the config.php file, please create this manually before continuing by copying the below into a config.php in the root directory of your install (typically /opt/librenms/)
"); + echo("
<?php\n".stripslashes($config_file)."
"); } } ?> @@ -549,3 +552,4 @@ elseif($stage == "6") + From d16784c040af647ec0059fe95ba3b2afb46801e1 Mon Sep 17 00:00:00 2001 From: f0o Date: Mon, 11 May 2015 09:07:15 +0000 Subject: [PATCH 4/4] This is not a fix for the issue! It does however minimize the risk of running into zombies for certain distribution's php5.x packages. It's been said it works for: Ubuntu 14.04.2 under Apache2's Mod-PHP using php5.5 OpenSuSE 13.2 under Apache2's Mod-PHP using php5.6 Debian 8 under Apache2's Mod-PHP and PHP-FPM using php5.6 --- includes/rrdtool.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index a2a6fcc02..1fbe6e4dc 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -60,7 +60,7 @@ function rrdtool_pipe_open(&$rrd_process, &$rrd_pipes) * @param array rrd_pipes */ -function rrdtool_pipe_close(&$rrd_process, &$rrd_pipes) +function rrdtool_pipe_close($rrd_process, &$rrd_pipes) { global $debug;