0

I am using Ubuntu server with LAMP and I installed phpMyadmin to manage database. By default phpmyadmin session is destroying after 1440 sec.

I have gone through different online tutorials and forums but no method works.

Bikram Pahi
  • 1,107
  • 1
  • 12
  • 33

1 Answers1

1

According to the documentation:

  • Edit the phpMyAdmin config.inc.php and add (or edit) the $cfg['LoginCookieValidity'] directive, for instance $cfg['LoginCookieValidity'] = 10080
  • Edit the PHP configuration file php.ini (making sure to edit the correct one; you can use phpinfo() to locate the correct location) and extend the time for session.gc_maxlifetime to at least the same value you used for LoginCookieValidity.

EDIT

You don't want to change the session.gc_maxlifetime for all of your applications, but there's still hope. Since you are using Apache and if the corresponding <Directory> entry in your Apache configuration contains AllowOverride Options (or AllowOverride All), then you should be able to configure this on a per-application basis to only affect phpMyAdmin.

You'll need to create a .htaccess file in the top level of the phpMyAdmin directory and include a line like:

php_value session.gc_maxlifetime 10080

That will force the modified setting only for that folder (and subdirectories), so as long as it's in your phpMyAdmin folder it will only affect the phpMyAdmin application.

If you prefer, you should be able to create (or modify) an Apache vhost and edit the PHP setting directly in the Apache configuration; the configuration directive would be exactly the same,

php_value session.gc_maxlifetime 10080

These methods will only work if the AllowOverride directive is set to either All or Options; lesser settings such as None will not allow these changes.

More details.

Community
  • 1
  • 1
Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
  • I appreciate your effort, but I don't want to change default php session time out / cookie destroy time because it will affect all other websites running on my server. I only want to change it for PHPMyAdmin – Bikram Pahi Oct 08 '15 at 12:28
  • Unfortunately the PHP sessions override anything you'd set in phpMyAdmin, for a very good reason -- applications shouldn't be able to set higher resource limits than the system administrator dictates. Depending on your webserver configuration, you may be permitted to set the gc_maxlifetime value just for the phpMyAdmin folder. I'll modify my answer to include more details. – Isaac Bennetch Oct 08 '15 at 13:20
  • I am facing the same issue. –  Oct 18 '15 at 13:14