Brochner
Member
Posted 2 months ago #
Every time some one tries to post a comment on my blog this error gets displayed.
Fatal error: Cannot redeclare class PHPMailer in D:\Domains\nickibrochner.com\wwwroot\wp-includes\class-phpmailer.php on line 21
I can deduct that is has something to do with sending me an email with a notification about that there is a comment awaiting me. But how do I solve this Fatal Error ?? ;)
.Nicki
I'm having the same problem with WP 2.5. The problem is actually in pluggable.php at the start of function wp_mail, about line 265. Somehow the checks for phpmailer's prior existence are saying it's not there when it really is. I'm awaiting a call from support on how to proceed or if it's a configuration issue on the server.
The PHPMailer class is already defined, but WP 2.5 doesn't check before redeclaring it if the $phpmailer object doesn't exist. To fix this, go into /wp-includes/pluggable.php. Go down to line 267 which should look like this:
require_once ABSPATH . WPINC . '/class-phpmailer.php';
Change it to this:
if ( !class_exists("PHPMailer") ) require_once ABSPATH . WPINC . '/class-phpmailer.php';
That should take care of it. Or, if you know your host won't be changing anything, simply comment out line 267.