Forums

Fatal error: Cannot redeclare class PHPMailer (3 posts)

  1. 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

  2. w1m
    Member
    Posted 3 weeks ago #

    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.

  3. w1m
    Member
    Posted 3 weeks ago #

    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.

Reply

You must log in to post.

About this Topic