Cannot modify header information - headers already sent by. error by webhost no my web


Hi, i am reciving this error on my web hosted by 000webhost, but is not my web, i downloaded from the file explorer and tested with xampp and all work fine, this is the code

<?php session_start();if(!isset($_SESSION['username'])){header("location: login.php"); exit;}?>
and of course the code is on top without white space on the start or end, so i am not sure what is happening :frowning:


Good day, sir!

Make sure you’re not sending the headers after sending any other output. If you are not aware how headers are working, please add the following line to /public_html/.htaccess. It’ll most likely solve your issue :slight_smile:

php_value output_buffering on


This topic was automatically closed after 42 hours. New replies are no longer allowed.