diff --git a/modules/ldapstatus/lib/LDAPTester.php b/modules/ldapstatus/lib/LDAPTester.php
index f5c1bd72cb4b830e01896ad8d31c9dc115f12e5b..51a122ae2abcc0406dcbbdf668764e672c39d90e 100644
--- a/modules/ldapstatus/lib/LDAPTester.php
+++ b/modules/ldapstatus/lib/LDAPTester.php
@@ -49,6 +49,7 @@ class sspmod_ldapstatus_LDAPTester {
 		} else {
 			SimpleSAML_Logger::debug('ldapstatus phpping(): ping [' . $host . ':' . $port . ']' );
 		}
+		flush();
 	}
 	
 	private function phpping($host, $port) {
diff --git a/modules/ldapstatus/www/index.php b/modules/ldapstatus/www/index.php
index 97afc262088e7e61f2517466f23197bceb778264..26dce3517fde50f7b4abe1291409db01a4324746 100644
--- a/modules/ldapstatus/www/index.php
+++ b/modules/ldapstatus/www/index.php
@@ -30,6 +30,7 @@ function myErrorHandler($errno, $errstr, $errfile, $errline) {
     	echo('<p>PHP_UNKNOWN : [' . $errno . '] ' . $errstr . '. Unknown error on line ' . $errline . ' in file ' . $errfile);        
         break;
     }
+    flush();
 
     /* Don't execute PHP internal error handler */
     return true;