Hey there! any question in your mind? Ask It Now!.

Popular Categories

PHP Error "Cannot modify header information" - headers already sent by

0 votes
asked in Programming by Micky

This error is coming when I am trying to run my php script


Warning: Cannot modify header information - headers already sent by (var/home/www/html/project /src/run.php:13) in src/run.php on line 33


And these lines 13 and 33 contains header() and setcookie() function.


can you please tell me the solution and reason as well as.


2 Answers

0 votes
answered by Andrew Rout (140 points)
Quick fix is to wrap the code with ob_start(). Error means that you are prematurely sending output to the browser
0 votes
answered by amit_pammu Expert (5,030 points)

remove the white spaces in your file after the php closing tag i.e ?>, php tags must be close properly ,  or you can remove the php closing tag and remain it open server will close it by itself.

Related Questions

0 votes
0 answers 135 views
+8 votes
3 answers 121 views
+1 vote
1 answer 180 views
+1 vote
1 answer 154 views
+1 vote
1 answer 75 views
+4 votes
5 answers 713 views
0 votes
1 answer 9,830 views
+2 votes
3 answers 280 views
asked in Programming by jatin Expert (3,823 points)
+1 vote
2 answers 5,114 views

Not a Member yet?

Ask to Folks Login

My Account
1017 Folks are online
86 members and 931 guest online
Your feedback is highly appreciated