In fact, this situation is generally due to the following aspects of the program modification process error operation caused:
Reason one, UTF8 encoding and BOM conflicts ( most common )
If you log in backstage similar to Warning:cannot modify header information–headers already sent by (output started at/www/wp-content/themes/p ozhejun/function.php:1) in/www/wp-includes/pluggable.php on line 897
Warning:cannot Modify header Information–headers already sent by (output started At/www/wp-content/themes/pozhejun/fun ction.php:1) in/www/wp-login.php on line 21
These PHP code errors, the first consideration is not function.php, wp-login.php, pluggable.php three php file encoding problems. It is most likely that a TXT file has been used to edit these error files resulting in UTF8 encoding and BOM conflicts.
workaround : Edit the file using notepad++, UltraEdit, DW and other editors, and in the "Modify" menu, select "Title/Encoding" To change the file encoding to the original GKB or utf-8 format. Of course you can also save the file as, choose ANSI save.
Reason two: There are spaces before or after the program file <?php ( most common )
workaround : Whether the program itself echoes out, the include in the program Echo or the PHP code outside the HTML exists space, they are all output. So, to check for errors in the fuction.php files such as <?php. > is not due to spaces or line breaks, especially for include or require files. Removing a space can be solved, which is one of the most common causes of error.
Reason three: plug-in compatibility issues ( common )
If it is to install WordPress plug-ins or their own program to write the above problems, in addition to the above two possibilities, there may be setcookie problems.
workaround : Before outputting the content, produce the cookie, can add function Ob_start () at the top of the program; Add the following function to the beginning of the file.
<?php Ob_start ();?>
Cause four: php.ini configuration issues
workaround : Open php.ini and set output_buffering to ON, restart Appache. This method opens the output cache for all PHP programs, which can affect the efficiency of PHP execution, depending on the performance of the server and the complexity of the code.
Reason five: Add exit after header ()
workaround : Add exit () after the header;
Header ("location:xxx");
Exit ();
The above is WordPress appears "Warning:cannot Modify header Information–headers already sent by ..." The common causes and solutions of such errors, If this is the case in the latter part of the operation of the situation is generally a file modification or plug-in incompatible with the problem, before solving this problem to clear the time of the problem is what modified, so as to quickly find the final cause of the error, so as to quickly solve the problem.
This article is from the "Liu Bofang blog" blog, make sure to keep this source http://liubofang.blog.51cto.com/11162557/1870666
How to solve PHP warning:cannot modify header information error?