diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index e8ff31f85a70abd40e0b4b852467553bbe221620..5686ac18a5d30b74d1cb00d177bceda0ee8e49a7 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -637,6 +637,11 @@ function replaceLine($filename, $search_pattern, $new_line, $strict = 0, $append
 					$out .= $line;
 				}
 			}
+			if (!$found) {
+				if (trim($line) == $new_line) {
+					$found = 1;
+				}
+			}
 		}
 		if($found == 0) {
 			//* add \n if the last line does not end with \n or \r