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

Not a Member yet?

Ask to Folks Login

My Account
342 Folks are online
2 members and 340 guest online
Your feedback is highly appreciated