From 2b561e0abff20b33dd1e94c2809e4cb1caae488e Mon Sep 17 00:00:00 2001 From: Ermal Date: Mon, 26 Nov 2012 23:59:33 +0100 Subject: Use popen here to not reach php memory limits --- config/openbgpd/openbgpd_status.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/config/openbgpd/openbgpd_status.php b/config/openbgpd/openbgpd_status.php index b493236f..4547018a 100644 --- a/config/openbgpd/openbgpd_status.php +++ b/config/openbgpd/openbgpd_status.php @@ -59,14 +59,9 @@ function doCmdT($title, $command) { } fclose($fd); } else { - $execOutput = ""; - $execStatus = ""; - exec ($command . " 2>&1", $execOutput, $execStatus); - for ($i = 0; isset($execOutput[$i]); $i++) { - if ($i > 0) { - echo "\n"; - } - echo htmlspecialchars($execOutput[$i],ENT_NOQUOTES); + $fd = popen("{$command} 2>&1", "r"); + while (($line = fgets($fd)) !== FALSE) { + echo htmlspecialchars($line, ENT_NOQUOTES); } } echo "\n"; -- cgit v1.2.3