Search code examples
phpcodeignitersessionwebserver

CI Can't find session variable when project is accessed from server


EDIT: Zen's comment below (which is already the accepted answer) did the trick. I've overwritten the php.ini on the server with the one on my workstation. I no longer have this problem.

On the server: I've tried to print $this->session->userdata('uid') in the controller right after I've set this session, and everything's good during that point but when I var_dump this uid in my login page it returns false. It doesn't exist. I've also already tried erasing cookies and everything in my browser several times. Also tried rebooting.

On my localhost: Everything is working fine.

Has anybody experienced this?

Background: After the system gets the login information entered by the user then validated if the user exists in the database, that's when this session variable is set in the model.

Has anybody experienced this?

My work station is running XAMPP 1.7.7 on windows 7 and the server is using XAMPP for linux on centOS, my browser is chrome. Anything else I should specify please let me know.


Solution

  • Try using exactly the same php.ini file from your local server on the remote CentOS machine - this will eliminate the possibility of an error in the php configuration (and turns out, that happened...)

    This should always be high on your "what is causing this unexplained problem with PHP?" list.