1

I have tried multiple way to extend this, so as to not have to log in every 1440 seconds on a development server. Yet the problem still persists.

Could anybody advise on the "correct" way to achieve this? I want to set to cookie session timeout to 3600 (1 hour) instead of the default 1440.

I have tried:

  • Set: 'session.gc_maxlifetime' within my php.ini file
  • Gone onto phpmyadmin under Settings => Features => General => Login cookie validity and set this to be the timing I want.
  • Gone into config.ini.php in the phpmyadmin files and set: '$cfg['LoginCookieValidity']' to the required time.

Each attempt I have made sure to restart apache so as to load the new configuration. However the problem still persists.

Any help/advise will be much appreciated.

JustSteveKing
  • 968
  • 1
  • 10
  • 29

2 Answers2

2

You have to edit phpmyadmin's configuration file (config.inc.php) and set the variable $cfg['LoginCookieValidity'] = 3600, I've put it at the end of the file.

Next, you have to increase the php session timeout if it is lower than 3600 seconds, to do that you have to set session.gc_maxlifetime in the php.ini file.

After that you have to restart apache.

I have done it so and it works on Ubuntu 14.04.

beni0888
  • 1,050
  • 1
  • 12
  • 40
1

First you need to verified that is ini_set allowed on your system or not?

To find out what the default (file-based-sessions) session timeout value on the server is you can view it through a ini_get command:

$currentTimeoutInSecs = ini_get(’session.gc_maxlifetime’);

// php.ini setting required for session timeout.

ini_set(’session.gc_maxlifetime’, 3600);
ini_set(‘session.gc_probability’,1);
ini_set(‘session.gc_divisor’,1);


session_set_cookie_params(3600);   

session_start(); // ready to go!

if you want to change the session.cookie_lifetime.

This required in some common file because to get the session values in whole application we need to write session_start(); to each file then only will get $_SESSION global variable values.

$sessionCookieExpireTime=8*60*60;
session_set_cookie_params($sessionCookieExpireTime);
session_start();
Hardy Mathew
  • 684
  • 1
  • 6
  • 22
  • I tried the above with: echo 'Session Lifetime : ' . ini_get('session.gc_maxlifetime'); Which displayed the 3600 as I had set in the php.ini file. However the problems still persists on phpmyadmin. I can't quite figure out what could be causing this. The system is obviously working - however phpmyadmin seems to be ignoring this? Any thoughts? – JustSteveKing Sep 25 '14 at 12:45
  • just open up config.inc.php in the root phpMyAdmin directory and add this setting `$cfg['LoginCookieValidity'] = ;` Where is some number larger than 1800. you can check the below link for more detail, [Link1](http://stackoverflow.com/questions/4361416/phpmyadmin-configuration) [Link2](http://stackoverflow.com/questions/11272973/phpmyadmin-automatic-logout-time) – Hardy Mathew Sep 25 '14 at 13:13
  • I have already tried this in /etc/phpmyadmin/config.ini.php or do I need to do it in /var/lib/phpmyadmin/config.ini.php ? – JustSteveKing Sep 25 '14 at 14:06
  • not sure , but it will work for me when I changed in `/etc/phpmyadmin/config.ini.php` only – Hardy Mathew Sep 26 '14 at 05:14