Cookie authentication keeps database credentials out of phpMyAdmin's persistent configuration, but its default idle window can interrupt long administration tasks. Extending that window requires phpMyAdmin's login-cookie limit and PHP's session lifetime to agree.
The official Docker image loads persistent application overrides from /etc/phpmyadmin/config.user.inc.php and additional PHP settings from files under /usr/local/etc/php/conf.d. Read-only Compose mounts keep both changes outside the replaceable container filesystem.
The one-hour value below is 3600 seconds, longer than phpMyAdmin's default 24-minute login-cookie validity. Use the shortest interval that covers the work, because an unattended authenticated tab remains usable for the extended period.
Related: Find phpMyAdmin configuration files
Related: Deploy phpMyAdmin with Docker Compose
$ mkdir -p phpmyadmin
$ vi phpmyadmin/config.user.inc.php
<?php $cfg['LoginCookieValidity'] = 3600;
A longer login lifetime increases the exposure of an unattended authenticated browser. The endpoint should remain behind HTTPS and restricted network access, while the default session-only browser cookie avoids persistence beyond the browser session.
$ vi phpmyadmin/session-timeout.ini
session.gc_maxlifetime = 3600
PHP can discard session data after this many inactive seconds, so a smaller value would invalidate the phpMyAdmin login before LoginCookieValidity is reached.
services: phpmyadmin: volumes: - ./phpmyadmin/config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro - ./phpmyadmin/session-timeout.ini:/usr/local/etc/php/conf.d/session-timeout.ini:ro
Existing service mounts remain alongside these entries.
$ docker compose config --quiet
A valid configuration exits with status 0 and prints no output.
$ docker compose up --detach --force-recreate phpmyadmin
$ docker compose exec phpmyadmin php -r '$cfg = []; require "/etc/phpmyadmin/config.user.inc.php"; printf("LoginCookieValidity=%s\nsession.gc_maxlifetime=%s\n", $cfg["LoginCookieValidity"], ini_get("session.gc_maxlifetime"));'
LoginCookieValidity=3600
session.gc_maxlifetime=3600





