Sunday, August 8, 2010

Warning: Cannot modify header information - PHP error on packages - Solved

Warning: Cannot modify header information

You can resolve this error in three ways. This recently happened on a plain vannila wordpress install just modifying the wp_config.php in windows. The file encoding got changed to UTF (With BOM).

As a normal user if you are just installing the package or if you edited a file then this is purely a encoding problem on the file.

Use editor like notepad++ and change the encoding of the file (Encoding Menu) to ANSI or if the File is in UTF-8  then encode in Encode in UTF-8 Without BOM. This should resolve the problem.

If you are developer having code problem,

  1. Chances you have space or empty lines or characters going out of your code before the
  2. Use ob_start(); function. If you cannot control the output then use ob_start(); function at top the page, then your problem of "modify header" will be resolved. ob_start() is output controlling function. This is an urgent way of fixing it but not a clean way.


Hope this helps.

No comments: