Worked until now, but: Cannot use output buffering in output buffering display handlers


(frodo) #1

Hi,

I´m using Piwik for years - so this isn´t a fresh installation but a working installation (until now). But since last week I get this error:

Fatal error: ob_start() [ref.outcontrol]: Cannot use output buffering in output buffering display handlers in core/ErrorHandler.php on line 29

My server is running with PHP 5.2.13 and MySQL 4.1.22. My provider didn´t change anything in the last days that could influence my piwik installation. My piwik installation is 1.4.

Do you have any ideas?

Best regards,
Fabian.


(vipsoft) #2

The error message is because you have an output handler (e.g., gzhandler) that doesn’t like stacking output handlers (even though the output is captured to a variable). You can disable it using a .htaccess file containing:


php_value output_handler none

Alternatively, in core/ErrorHandler.php, comment out the ob_start()…ob_end_clean() block, and add the one-line that serializes the output from debug_backtrace(), i.e.,


Index: ErrorHandler.php
===================================================================
--- ErrorHandler.php	(revision 4651)
+++ ErrorHandler.php	(working copy)
@@ -26,10 +26,13 @@
 		return;
 	}
 	
+/*
 	ob_start();
 	debug_print_backtrace();
 	$backtrace = ob_get_contents();
 	ob_end_clean();
+*/
+	$backtrace = serialize(debug_backtrace());
 
 	try {
 		Zend_Registry::get('logger_error')->logEvent($errno, $errstr, $errfile, $errline, $backtrace);

This will allow you to find out why the error handler is being called.


(frodo) #3

Hi Anthon,

thank you for your reply. It helped me indirectly to work on…

The error message is because you have an output handler (e.g., gzhandler) that doesn’t like stacking output handlers (even though the output is captured to a variable).

.htaccess didn´t help - it caused an error 500.

Trying to display errors didn´t show anything but a blank page.

So I commented out everything in the function Piwik_ErrorHandler and so I got a broken piwik page with no tracking results. But I saw that I was using the last piwik version before 1.4 and tried to update to the latest - and this helped magically. Now everything is fine again. Don´t know why…

Thanks a lot!

Best regards,
Fabian.


(vipsoft) #4

Hmph. The error 500 may mean your Apache conf doesn’t allow .htaccess files.


(frodo) #5

Yes, I think so…