Thursday, 8 November 2018

Mysql: phpmyadmin logs out after 1440 secs

In my local development Ubuntu box I use MySQL and phpmyadmin to work with the database.
Whenever phpmyadmin is idle for 1440 secs (24min) the session expires. I lose my place and have to login and start over.
I tried changing the $cfg['LoginCookieValidity'] = 3600 * 9; inside config.inc.php but it still times out in 1440 seconds.
I have restarted everything and cleared the browser cache (Firefox history -> Clear recent history -> Cache -> Everything).
I'm not sure why the increased timeout does not take effect. What am I doing wrong?

 Answers


Go to PHPMyAdmin in your browser
Settings > Features > Change the value of Login cookie validity > Save






There seems to be UI for changing phpmyadmin configurations Start apache and click the following link
http://localhost/phpmyadmin/setup/index.php?page=form&formset=Features#tab_Security



You should restart apache or httpd, not mysqld
sudo service httpd restart
or
sudo /etc/init.d/apache2 restart



You will then get another warning: “Your PHP parameter session.gc_maxlifetime is lower that cookie validity configured in phpMyAdmin, because of this, your login will expire sooner than configured in phpMyAdmin.“. That makes sense because php’s session will time out first anyways. So we will need to change /etc/php.ini .
session.gc_maxlifetime = 43200
That’s 12 hours in seconds. 
Restart your apache server and you are done!



It is not working. The PHP session will expire anyway after 1440 seconds.
Change in PHP.ini this too:
session.gc_maxlifetime = 3600
Also, from PHP.ini:
If you are using the subdirectory option for storing session files
; (see session.save_path above), then garbage collection does not
; happen automatically. You will need to do your own garbage
; collection through a shell script, cron entry, or some other method.
; For example, the following script would is the equivalent of
; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
; cd /path/to/sessions; find -cmin +24 | xargs rm



If the parameter $cfg['LoginCookieValidity'] is not taking effect in config.inc.php file, try disabling the session.gc_maxlifetime in the php.ini file by putting a semicolon to the left like this:
; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
; http://php.net/session.gc-maxlifetime
; session.gc_maxlifetime = 1440
Or try disabling both $cfg['LoginCookieValidity'] and session.gc_maxlifetime = 1440 by commenting both out.
Then phpMyAdmin should no longer log out when you idle. It works for me on Windows. Don't forget to clear your browser cache and restart your webserver.



To set permanently cookie you need to follow some steps
Goto->/etc/phpmyadmin/config.inc.php file
add this code
$cfg['LoginCookieValidity'] = <cookie expiration time in seconds > 



I have found the solution and using it successfully for sometime now.
Just install this Addon to your FF browser.



It worked for me after I
  • changed the $cfg['LoginCookieValidity'] in (phpmyadmin folder)/libraries/config.default.php to 999999999.
  • checked the php.ini used by the phpmyadmin by php5 -i | grep php.ini.
  • went to the php.ini file whose path I got from the grep command output and changed the session.gc_maxlifetime value to 999999999.
  • restarted the server. In my case it was sudo service apache2 restart.
Done. Logged in phpmyadmin and checked the cookie validity in Settings -> Features -> General -> Login cookie validity. It was 999999999. Also there was no warning "Your PHP parameter session.gc_maxlifetime is lower that cookie validity ...". The warning showed after I logged in phpmyadmin before I changed the php.ini file.
Check the version of php used by the phpmyadmin. You should change the ini file of the php that is used by the phpmyadmin. I have php5 and php(i.e 7) both installed. But my phpmyadmin uses php5. So I had to search for ini file of php5.

0 comments:

Post a Comment