Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP: Cannot send session cookie error [duplicate]

Tags:

php

session

Im trying to set up a session and i am getting a header error, dispite as far as i can tell i am telling it to start the session before the header is sent. any help here would be useful.

<?php
ob_start();
session_start();
$_SESSION['active'] = 1;
ob_end_flush();
?>
<html>
<body>
2009c Christ Redeemer Catholic Church 
</body>
</html>

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/k/u/r/kuriomister/html/temp/church/index.php:1) in /home/content/k/u/r/kuriomister/html/temp/church/index.php on line 3

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/k/u/r/kuriomister/html/temp/church/index.php:1) in /home/content/k/u/r/kuriomister/html/temp/church/index.php on line 3

like image 908
user54229 Avatar asked Dec 17 '22 09:12

user54229


1 Answers

If you use UTF-8, be sure to save the file without BOM.

like image 158
Gumbo Avatar answered Jan 04 '23 10:01

Gumbo