Skip to content
Advertisement

PHP Session Timing Out Soon

I am working on a PHP role based application in which I have to maintain session as well. once the user is logged in he will be redirected to his interface where I manage session as The user id and password would match with the role. if it doesn’t match he would be redirected to the login as below.

JavaScript

This also is interacted with a datatable in which whenever the session is being timedout, its throwing an error for the table which is :

datatables warning table id= – requested unknown parameter ‘0’ for row 0 column 0 tn/4

I think If I increase the session timeout, This wouldn’t be a burden. I tried to do in every possible way but all ended up with failures.

  • Increasing php.ini session.gc_maxlifetime
  • Overriding php.ini by pages as ini_set(‘session.gc_maxlifetime’, 31536000)
  • Edit MultiPHP INI editor

Nothing seems like working except its local. Please advice.

Update (How session and cookies are structured from login):

JavaScript

Advertisement

Answer

After so many attempts, What worked was we have to change the session path to “/tmp” on .htaccess. This is how it would seem to work if the app is hosted in a shared hosting.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement