WordPress: Warning: Cannot modify header information

Hi,

when you change your Provider or your provider changes PHP version the Login page of WordPress (wp-login.php) shows an error message like this and a login is impossible:

Warning: Cannot modify header information headers already sent by…

Wordpress Cookkie Error
WordPress Cookkie Error

 

This error could occur when

  • A file has a encoding format which PHP cannot interpret correctly. For example UTF-8 with BOM
  • Whitespaces , Carriagereturns or “invalid” characters before “<?php” tags
  • Whitespaces or Carriagereturns after “?>” tags

For troubleshooting this issue activate temporary debugging in the wp-config.php by setting

define('WP_DEBUG', true);

Open the Login page. Some debug lines should appear at the top of the page which points to the file and the line which raises the error. In this example the QuickAdsense Plugin. Line 1 indicates that the file encoding is wrong, a line number higher then 1 indicates invalid characters. In the example both occurs.

Plugin Error

The error is located at line 1009. Open the file. I recommend notepad++, a very good editor. Go to the line

Error detail

In this example some carriage returns causes the error. Remove them and convert the file to ANSI encoding. This should always work.

Error Detail

Error fixed

Convert to ANSI Encoding

This should fix the problem.

Michael
 

Leave a Reply Cancel reply