Show Header error on localhost

纵饮孤独 提交于 2019-12-11 09:35:53

问题


When I uploaded my site to the server I got these errors.

Warning: Cannot modify header information - headers already sent by (output started at /home/content/j/o/u/jou/html/biggydaddy/wp-config.php:25) in /home/content/j/o/u/jou/html/biggydaddy/wp-login.php on line 12

I understand the reasons behind them, but in my localhost this warning not shown.

How do I display those errors?


回答1:


1)This error comes when you print any thing before php hreader command

Please check for any echo or print / print_r .. (or may be White Space)
2) You need to set both error_reporting and display_errors. These can be set in php.ini, in Apache (if you're using PHP as an Apache module) or during run-time, though if you set it during run-time then it won't effect some types of errors, such as parse errors.




回答2:


Be sure that you have set output_buffering=Off for showing error on localhost you have to set output_buffering=Off in your php.ini file and then restart your XAMPP .....




回答3:


Have a look at the file mentioned (/home/content/j/o/u/jou/html/biggydaddy/wp-config.php) and make sure nothing is being output from there. This could be as simple as an extra space before the opening <?php tag.

In my Wordpress config file that line is the DB password. Make sure that you haven't got any characters there like an extra unescaped quote that could cause problems.




回答4:


Sometimes it's some space characters after the final ?> in a PHP file.




回答5:


It seems you are using wordpress then set WP_DEBUG constant to true in wp-config.php:

define('WP_DEBUG', true);

Or if for normal php script set:

error_reporting(E_ALL);
ini_set("display_errors", 1);

Hope this will help you.



来源:https://stackoverflow.com/questions/11304868/show-header-error-on-localhost

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!