Resolving the error notice ob_end_flush()

If you have developed your website on WordPress and encounter the error message “Notice: ob_end_flush(): failed to send buffer of zlib output compression (0)” at the bottom of your site, both in the development backend or public view, you can resolve the issue by following these steps.

  • Disable compression plugins: If any compression plugins are installed, such as WP Rocket or W3 Total Cache, temporarily deactivate them. Sometimes, conflicts between different compression mechanisms can cause this error message. (Note: This may not be the affecting issue but worth to check)
  • Enable debugging: Open your wp-config.php file, which is located in the root directory of your WordPress installation. You can access it from your cPanel. Add the following code snippet to enable debugging features.

Code you may need to paste in your wp-config.php file (Snippet A)

// 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 );

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );

Enabling debugging will help capture detailed information about the error, which can be useful for troubleshooting. It is highly likely that you may already have the following code snippet

Code already may exist on your wp-config.php file that needs to be replaced by the above code

define( 'WP_DEBUG', true ); 

on your wp-config.php file. In that case, just highlight that line and paste the above code mentioned in Snippet A

  • Save the changes.
  • Note: It is always recommended to make a copy of your original wp-config.php file in case any problem happens due to this change. You can always use the original file to upload it back.
  • Clear cache: Clear any cache on your website, including browser cache and any caching plugins you may have installed.
  • Test your website: Reload your website and check if the error message has disappeared. If the issue persists, review the debug.log file located in the /wp-content/ directory for any error logs. This can provide additional information to diagnose the problem.

By following these steps, you should be able to resolve the “error Notice: ob_end_flush(): failed to send buffer of zlib output compression (0)” message on your WordPress website.

Note: Above mentioned method worked for me. Be very careful when you make any changes in the wp-config.php file.