1

I'm getting an error during a fresh wordpress installation stating:

Warning: Cannot modify header information - headers already sent by (output started at /www/99k.org/r/e/a/realestatedemo/htdocs/wp-includes/class-phpmailer.php:514) in /www/99k.org/r/e/a/realestatedemo/htdocs/wp-includes/pluggable.php on line 896

The problem is the issue is almost always due to blank space in the PHP file however I do not seem to have any. I'm wondering if this could be an issue with the server/hosting I'm using: Zymic.com

The error references class-phpmailer.php:514 which is shown on the line below:

  $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header);

in this section of the code:

  private function mail_passthru($to, $subject, $body, $header, $params) {
    if ( ini_get('safe_mode') || !($this->UseSendmailOptions) ) {
        $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header);
    } else {
        $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header, $params);
    }
    return $rt;
  }

P.S.

I have already attempted the check for whitespace in notepad++ as mentioned here:

How to fix "Headers already sent" error in PHP

and I don't see any reference to Print or echo near that line (as suggested in the SO post above) either.

Community
  • 1
  • 1
  • The fix in the linked article does not seem to resolve the issue as mentioned above (the white space issue) I need help figuring out what else might be causing it!! – user3317105 Mar 19 '14 at 03:50
  • The downvote was completely unwarranted. – user3317105 Mar 19 '14 at 03:51
  • What version of Wordpress are you using? – Phil Mar 19 '14 at 03:54
  • Wordpress version 3.8 – user3317105 Mar 19 '14 at 04:01
  • My guess is that even with the error supression, `@mail` is triggering a visible warning. Might have something to do with running in safe mode – Phil Mar 19 '14 at 04:09
  • Any idea how I might avoid this or prevent it from it from occurring? – user3317105 Mar 19 '14 at 04:10
  • Is 'output_buffering' turned on in php.ini? This question [php-how-detect-if-output-buffering-is-turned-on](http://stackoverflow.com/questions/5608975/php-how-detect-if-output-buffering-is-turned-on) has a lot of details that you may find useful. – Ryan Vincent Mar 19 '14 at 04:23
  • If you are running PHP in *safe_mode*, I strongly suggest you don't do that – Phil Mar 19 '14 at 04:38
  • @phil, i thought that safe_mode' was not recommended any more, and should be turned off? – Ryan Vincent Mar 19 '14 at 05:57
  • @RyanVincent Indeed. It's even officially deprecated. Sorry, when I said *"don't do that"*, I meant *"don't run PHP in `safe_mode`"*. Wasn't replying to your comment :) – Phil Mar 19 '14 at 05:59

1 Answers1

0

Check whether there is any space between appended scripts or script sections:

?>
   // Blank space here
<?php

Meanwhile use can use ob_start(); function till you figure out the issue

Zameer Khan
  • 1,154
  • 1
  • 18
  • 20