2

I have hosted my code igniter application in AWS EC2. In that session is not setting the values in my login process. In php.ini file, i have set the session save path to /tmp.

session.save_path = '/tmp'

Session started and session id is generating. But session values are not storing.I have printed the $_SESSION and session id, below is the output.

string(26) "038vbmtjecvkqft02ou813qvo1" array(1) { ["__ci_last_regenerate"]=> int(1540479344) }

I have my session code as follows,

$this->session->set_userdata('frontusername', $res->Email);
$this->session->set_userdata('frontname', $res->FirstName);
$this->session->set_userdata('frontuserid', $res->Id);

Its working fine in my another server, but not here in AWS EC2. Have restared the apache after setting the save path and checked the error log under /var/log. No error. Also /tmp folder is writable.

My php.ini file, enter image description here

Searching for last two days, no luck. Any help please, thanks in advance.

nevada_scout
  • 971
  • 3
  • 16
  • 37
devkann
  • 79
  • 1
  • 12

1 Answers1

0

Check permission for session. I had the same problem and solved it by changing permission in ami.

The local value pointing /var/lib/php/session seems to be the problem as this directory is not writable by server user. I did not know anything about local and master value, and after some digging in google I read the following:

"Master Value" (from php.ini) could be overridden with "Local Value" in httpd.conf, .htaccess or other Apache configuration with php_value directive.

So after looking around server files i found /etc/httpd/conf.d/php.conf which contains:

#
Apache specific PHP configuration options
those can be override in each configured vhost
#
php_value session.save_handler "files"
php_value session.save_path "/var/lib/php/session"

So there is the problem, this php.conf is overwritting default php.ini configuration. I can comment this last line wih "#" and restart the server and all is working as expected again.

Hope this help.

Weber
  • 506
  • 5
  • 16