note 66974 deleted from function.session-register by cmb
| From: | cmb@php.net | Date: | Wed, 24 Feb 2021 12:10:48 +0000 |
| Subject: | note 66974 deleted from function.session-register by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-219124@lists.php.net to get a copy of this message | ||
Note Submitter: guideng at unlv dot nevada dot edu
----
Make sure you put session_start() at the beggining of your script.
My sessions kept unsetting and I finally figured out why.
On my script, session_start() has to be said and uses cookies to set the session.
But I was outputting html prior to calling session_start(), which prevented it from succeeding
becouse it uses the header function to place the cookies.
Once html has been outputed, session_start() can't use the header function to set cookies,
hence session_start() fails and no session can be started.