I have a PHP page where the user is redirected after a successful login. I go, test the login, and I come to the page, which complains that I can't call session_start. Will somebody please provide a solution?
Printable View
I have a PHP page where the user is redirected after a successful login. I go, test the login, and I come to the page, which complains that I can't call session_start. Will somebody please provide a solution?
Lets see the code and the error. Chances are you are calling session_start() after you've already outputted something to the screen.
Well, if by "outputted something to the screen" you mean the start of the body tag then I have found a solution. I will check, but in the meantime if you could give me some other possible causes and solutions that would be great. Thanks for your help!
I could give you help if you either gave me an error or some code.
99% of the time it is because of the reason I already stated, or because you've already opened the session.
Dear kfcSmitty,
1. Delete all the white space before session_start()
2. You can use the Hec editor (Free Hec Editor Neo) to check and delete.
3. Save php page and check.
Hope it can help.
LVD
You need to ensure there is not output prior to the session_start. Output includes a anything produced by an echo or print statement and anything outside <?php ?>. It also includes the Beginning of File Marker in Unicode file. Until PHP supports unicode properly, you will have to save all scripts as ASCII.