Note: ob_end_flush (): failed to send zlib (1) compression buffer to

I have no problem on localhost. but when I tested my codes on the server, at the end of each page I see this notification.

my code is:

<?php ob_start(); include 'view.php'; $data = ob_get_contents(); ob_end_clean(); include 'master.php'; ob_end_flush(); // Problem is this line 
+13
source share
6 answers

Solved when shutting down zlib.output_compression in php.ini

zlib.output_compression = Off

+6
source

WordPress is trying to flush the output buffers when shutting down. It fails because you already called ob_end_flush() .

You should be able to enable compression and just unhook the reset action:

 remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 ); 

Now you can call ob_end_flush() manually and enable zlib compression.

+20
source

I found that a particular plugin was the cause on one of our WP client sites.

In this case, it was caused by the NextGEN Gallery plug-in, but the strange simple deactivation and subsequent activation of the plug-in solved the problem.

For those who are faced with this problem, it is worth looking for suspicious external interfaces and trying the same thing. If you find that the problem returns after reactivating the plug-in, you should inform the author of the plug-in about this.

+2
source

Too late with the answer, but next time try to find define('WP_DEBUG', true); on your website wp-config.php and set true to false , then save the file.

0
source

For security reasons, you should always disable errors that occur on the front, on live sites.

If you want to hide errors in Wordpress and get an error log for viewing, you can do something like the following in your wp-config.php file:

 // Enable WP_DEBUG mode define( 'WP_DEBUG', true ); // Enable Debug logging to the /wp-content/debug.log file define( 'WP_DEBUG_LOG', true ); // Disable display of errors and warnings define( 'WP_DEBUG_DISPLAY', false ); @ini_set( 'display_errors', 0 ); 

PS: if you want to use the remove_action code from alexg above, remove_action('shutdown', 'wp_ob_end_flush_all', 1); you will need to put it in the functions.php file of your theme.

PPS: You can also try using define('WP_MEMORY_LIMIT,1024M); in your wp-config.php file - however, be careful not to allocate more than you need, as this affects the external interface of Wordpress, and you run the risk of running out of RAM if you have too many simultaneous page calls.

0
source

Try disabling WordPress debugging mode and it is resolved. You can disable WP debugging mode in /wp-config.php :

 define('WP_DEBUG', FALSE); 
-7
source

All Articles