Fix the error: Parameter 1 to W3_Plugin_TotalCache::ob_callback() expected to be a reference,

I checked my Nginx log files and saw a lot of errors as below:

*11047 FastCGI sent in stderr: “PHP message: PHP Warning: Parameter 1 to W3_Plugin_TotalCache::ob_callback() expected to be a reference, value given in /home/users/yinfor.com/wp-includes/functions.php on line 3597” while reading response header from upstream,

I googled it and found the answer.

The reason why it happened is PHP 7 and W3 Total Cache.

Since I can not change PHP 7, I have to change something in W3 Total Cache plugin.

  1.  Find the file /wp-content/plugins/w3-total-cache/lib/W3/Plugin/TotalCache.php
  2.  Go to line 512, and replace following
    function ob_callback(&$buffer)
    with
    function ob_callback($buffer)
  3.  Save it.