Error - Warning: Cannot modify header information

2019-02-07 07:51发布

问题:

Error:

Warning: Cannot modify header information - headers already sent by (output started at /home/ya3mblog/public_html/wp-login.php:59) in /home/ya3mblog/public_html/wp-includes/pluggable.php on line 866

website: ipublisharticles.com Error is at: ipublisharticles.com/wp-login.php?action=register

It's preventing user registration using the proper method.

回答1:

Add this code in wp-config.php on the first line:

ob_start();
error_reporting(0);


回答2:

See How_do_I_solve_the_Headers_already_sent_warning_problem? > FAQ Troubleshooting « WordPress Codex

(This error) is usually because there are spaces, new lines, or other stuff before an opening <?php tag or after a closing ?> tag, typically in wp-config.php.

Open the file with a plain text editor (like Notepad or BBEdit) and clear out the white space. Check that the very first characters are <?php and the very last characters are either NOT a PHP closing tag, or a closing tag ?> with no blank lines or spaces after it. (FYI, a PHP file can run fine without the closing ?> tag.)

When saving, be sure the file encoding is not UTF-8 BOM but plain UTF-8 or any without the BOM suffix.

And:

This could be true about some other file too, so please check the error message, as it will list the specific file name where the error occurred. Replacing the faulty file with one from your most recent backup or one from a fresh WordPress download is your best bet.

If the error message states: Warning: Cannot modify header information - headers already sent by (output started at /path/blog/wp-config.php:34) in /path/blog/wp-login.php on line 42, then the problem is at line #34 of wp-config.php, not line #42 of wp-login.php. In this scenario, line #42 of wp-login.php is the victim. It is being affected by the excess whitespace at line #34 of wp-config.php.

If the error message states: Warning: Cannot modify header information - headers already sent by (output started at /path/wp-admin/admin-header.php:8) in /path/wp-admin/post.php on line 569, then the problem is at line #8 of admin-header.php, not line #569 of post.php. In this scenario, line #569 of post.php is the victim. It is being affected by the excess whitespace at line #8 of admin-header.php.



回答3:

remove the excess blankspace /home/ya3mblog/public_html/wp-login.php in line 59.



标签: wordpress