Home » Php » php – phpMyAdmin configuration

php – phpMyAdmin configuration

Posted by: admin April 23, 2020 Leave a comment

  • How do I increase phpmyadmin session timeout?
  • How do I increase phpmyadmin import file size limit(currently it says Max: 2,048KiB). I tried changing upload_max_filesize in php.ini but it didn’t make any difference.
How to&Answers:

config.inc.php > $cfg['LoginCookieValidity'] = 3600 * 9; // 9 hours

edit from the link posted by ajreal: LoginCookieValidity

for the second question , after changing upload_max_filesize in php.ini did you restart apache ( or whatever webserver you use ) ?


How to set phpMyAdmin default 1440 second timeout higher:

  1. locate php.ini

    [email protected]:/var/lib/phpmyadmin$ locate php.ini
  2. open the file as root to edit, find this line:

    session.gc_maxlifetime = 1440
  3. Change it to this (500000 seconds is 5.7 days)

    session.gc_maxlifetime = 500000
  4. Restart apache.

Doing this decreases security because then it increases opportunity for cross site scripting and man in the middle attacks. It’s all fun and games until you find your server is part of a botnet farming for credit cards.


  1. Edit phpMyAdmin’s config.inc.php and add or update LoginCookieValidity the value as follows:

    $cfg['LoginCookieValidity'] = 3600 * 9; // 9 hours
  2. To upload more than 2M:

    cd /etc/php5/apache2/php.ini
    sudo nano php.ini
  3. Search for upload_max_filesize in php.ini, and change value to 64M (for 64 Mb):

    upload_max_filesize = 64M
  4. Save and exit.

  5. Restart apache:

    sudo /etc/init.d/apache2 restart
  6. Finish!


For the first question, you need to change the $cfg[‘LoginCookieValidity’] config in the config.inc.php.
Open config.inc.php in the phpMyAdmin “root” directory. Look for a line that contains this: $cfg[‘LoginCookieValidity’]. Set the value to the desired amount of seconds. If the line doesn’t exist, just add it like this:

$cfg[‘LoginCookieValidity’] = 3600; //(3600 = one hour)

You will need to login again to phpmyadmin.

This also assumes that the PHP session garbage collection is set-up accordingly. This can be done in a number of ways:

  • php.ini; add a line (or change an existing) that contains session.gc_maxlifetime = <seconds>
  • Apache configuration; add a line to the appropriate block that says php_admin_value session.gc_maxlifetime <seconds>
  • config.inc.php (phpMyAdmin); after the previously edited line, add a line with ini_set(‘session.gc_maxlifetime’, <seconds>);

About the second question:

You need to change both, upload_max_filesize and post_max_size in your php.ini.
The post_max_size value needs to be at least the upload_max_filesize value.

Don’t forget to restart your server



Try by changing post_max_size in /etc/php.ini file.


Rather than setting session.gc_maxlifetime in the php.ini file, better to add the following to your config.inc.php file (typically in the /etc/phpmyadmin directory):

ini_set('session.gc_maxlifetime', '86400');

That way you don’t compromise security for other PHP scripts, or cause excessive clutter in the RAM due to infrequent Garbage Collection.


If you wished to keep phpMyAdmin from timing out so often, you might
add this line:

$cfg[‘LoginCookieValidity’] = 86400;

By default, phpMyAdmin times out every 1440 seconds; to change this,
change the session.gc_maxlifetime in php.ini as follows:

session.gc_maxlifetime = 86400



I’m aware this post has been answered, but I’ve just resolved the same issue, so I thought I would add my findings to help others.

I needed to increase the PhpMyAdmin upload file size limit from default the 2,048KiB and I too changed the upload_max_filesize and post_max_size and memory_limit, but nothing changed.

It took my a while to find the problem, when I used the phpinfo(); script to identify where the PHP.ini file was it said was here: C:\Program Files (x86)\iis express\PHP\v5.5\php.ini, but I finally noticed in the PhpMyAdmin homepage that the Web server was running version: 5.6.31. So, I updated the upload, post and memory limits in the PHP.ini for both versions 5.5 and 5.6 and the import limit in PhpMyAdmin increased.


Edit phpMyAdmin’s config.inc.php and add or update LoginCookieValidity the value as follows:

$cfg['LoginCookieValidity'] = 3600 * 9; // 9 hours

In wamp or xampp or anything you use at php.ini,
Search for upload_max_filesize this is where you should change it,

we suggest you not use more than 64M filesize cause sometimes it makes crash:

upload_max_filesize = 64M

Save and exit.


I add to Poelinca’s answer that the mechanism of this limit can be found in the PMA sources under libraries/Config.class.php,

function checkUploadSize()

It will use upload_max_filesize if defined or 5M else and if max_upload_size is also defined it will get the min of the two.

(PMA version 3.3.7deb7)