How to increase automatic logout time in phpMyAdmin

phpMyAdmin is open-source web based application that provides graphical interface for MySql or MariaDB database. When working in phpMyAdmin, you have noticed that it automatically logouts after 1440 inactive seconds. The error message shows No activity within 1440 seconds; please log in again.

You need to again login to continue use phpMyAdmin. It is sometimes feel hard to login again and again after 1440 seconds. You might want to increase the logout time.

This can be done in simple ways changing some file values.

First open /etc/phpmyadmin/config.inc.php setting file to nano editor.

sudo nano /etc/phpmyadmin/config.inc.php

And search for the below line or word using shortcut CTRL + W.

['LoginCookieValidity']

If you couldn't find this line, you need to add below line anywhere in the file.

$cfg['LoginCookieValidity'] = 43200; // 24 hours

The $cfg['LoginCookieValidity'] defines how many seconds login cookie is valid. You can set the seconds that you want to keep logout time.

Now save and exit the file. You also need to check php configuration option session.gc_maxlifetime at least or more than the value of $cfg['LoginCookieValidity']. So, you might need to set the session.gc_maxlifetime n /etc/php/8.0/apache2/php.ini configuration file in Ubuntu.

Note: You may be using different version than 8.0. So your path should be like /etc/php/<version.subversion>/apache2/php.ini

To see which php.ini file exactly using, create info.php file in /var/www/html and print fileinfo() function.

<?php
phpinfo();

Now open http://localhost/info.php in browser and serch for the line Loaded Configuration File.

If you don't want to change in this file, you may change php.ini configuration runtime for phpMyAdmin only. PHP allows to change phconfigurations using ini_set() function.

$session_timeout = 43200; // 24 hours
ini_set('session.gc_maxlifetime', $session_timeout);
$cfg['LoginCookieValidity'] = $session_timeout;

So, this way you can change automatic logout time in phpMyAdmin. I hope this will help you.

Tags:

Was this article helpful?

0 out of 0 person found this article helpful.

Leave a comment

Or

No Comment