Session headers have already been sent
I keep getting the error below. This problem does not exist on my localhost (xampp). When the files are on the server I get this problem.
Warning : session_start () [function.session-start]: cannot send session cookie - headers already sent (output started at / home / plosta / public _html / bloom / Connections / bloom.php: 1) to / home / plosta /public_html/bloom/signin.php on line 158
it happens on the server but not on localhost
<?php
//bloom.php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_bloom = "localhost";
$database_bloom = "datacenter";
$username_bloom = "root";
$password_bloom = "";
$bloom = mysql_pconnect($hostname_bloom, $username_bloom, $password_bloom) or trigger_error(mysql_error(),E_USER_ERROR);
?>
source to share
Usually when it says "headers already sent" It means that you have already started "output buffering" means that you have already started sending text to your user.
If this is unintentional (you don't have your code header settings), check a few things, for example:
- Line or character before "<php" of one of your files
- An echo that you forget somewhere in your code.
source to share
you can try with the following solutions:
-
Place a line of code
<?php ob_start(); ?>
at the top of your file -
check your signin.php file
session_start()
should be at the top of your code. Move form line 158 to line 1 -
Please check the code if you are printing any variable / array with
echo or print
, remove this
if you can paste the whole code of the file, it will be more clear for us to give you the right solution quickly.
source to share