FCGI PHP5 & W3 Total Cache Error

I recently found an error in W3 Total Cache after switching to FCGI. This error isn’t anything to send alarm bells ringing but it does use up resources when processing errors every time the page loads. It turns out this issue affects servers running in FCGI and PHP 5, you can check your error logs to find out if you have this problem.

The following errors were found in my log file.

mod_fcgid: stderr: PHP Deprecated:  Assigning the return value of new by reference is deprecated in /home/username/public_html/wp-content/plugins/w3-total-cache/lib/W3/Minify.php

and

mod_fcgid: stderr: PHP Deprecated:  Assigning the return value of new by reference is deprecated in /home/username/public_html/wp-content/plugins/w3-total-cache/lib/W3/Cdn.php

You may have errors in other files, but these were the ones causing the enourmous ammount of errors filling my logs up.

Just follow the path to the files and located the files where the errors are coming from.

In CDN.php you will see a long list of cases that look like this.

case (W3TC_PHP5 && $engine == W3TC_CDN_S3):
                    require_once W3TC_LIB_W3_DIR . '/Cdn/S3.php';
                    @$instances[$instance_key] =& new W3_Cdn_S3($config);
                    break;

The issue is that the idiom =& new is deprecated in PHP5 and needs to be replaced with just = new

You can fix this easily by locating the files and doing a search and replace.

Press control F or command F for mac ( I think )

Type in & new in the search bar and in the replace just type new and select replace all.

Then check your error logs taking note of the time of the last error and see if the errors stop.

I have notified Frederick Townes of the errors, so it may be fixed in time.

If you are not sure what PHP version you have, you can create a simple file in the root folder, i.e. same place as wp-content, wp-admin ect.

Call the file phpinfo.php and paste in the following code, save it and then enter sitename.com/phpinfo.php

<? phpinfo(); ?>

Just remember to delete it after, as it gives out a lot of information about your server configuration.

Meet the Author

Matthew Horne

Matthew Horne is web developer who specializes in optimized development. He also builds custom solutions instead of reverting to plugins. Matthew Has a strong understanding of PHP, JavaScript, jQuery.

1 comment… add one

Leave a Comment