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

Popular Categories





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

0 votes
380 views
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

+8 votes
3 answers 182 views
+1 vote
1 answer 198 views
+4 votes
5 answers 756 views
0 votes
1 answer 9,887 views
+2 votes
3 answers 303 views
asked in Programming by jatin Expert (3,823 points)
+1 vote
2 answers 5,692 views
+2 votes
1 answer 171 views
+1 vote
2 answers 105 views

Not a Member yet?

Ask to Folks Login

My Account
442 Folks are online
2 members and 440 guest online
Your feedback is highly appreciated