<?php
if(session_id() == '' || !isset($_SESSION))
session_start();
?>
i have this line of code in all my pages… and it is located at the very top of my script.. but unfortunately im getting an error on one of my script but the other pages didn’t get error… i tried to search it but they said that it is needed to be at the top of script before HTML.. just what i did… but i dont have any idea why im getting error on one of my pages.. i found this error when i start to upload it to my cpanel server.. but on my local server its totally working..
this is the warning message that i got.. and when i tried to remove this on one of my script which gives me the error message my page did not functioning well
Warning: session_start(): Cannot send session cache limiter – headers already sent
2
Answers
The session_start() function needs to be the first one
Posting as an asnwer as per the comment made by OP
This occurs if you have output before
session_start()
is called. The most typical culprit is a space (or any character) before the<?php
tag (be aware of zero-width space characters also).