How to Fix phpMyAdmin “$cfg[‘TempDir’] (./tmp/) is not accessible”
After installing or upgrading phpMyAdmin (4.9, 5.x), you often see a yellow warning banner at the bottom of the home screen: The $cfg['TempDir'] (./tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this. The app still works, but re-renders every Twig template from scratch on every request. Fixing it takes two minutes.
Quick fix: create the temporary directory, grant write ownership to your web server / PHP-FPM user (typically www-data), and set an explicit absolute path for $cfg['TempDir'] in config.inc.php.
Case 1. Manual Archive Installation of phpMyAdmin
Go to your phpMyAdmin root directory (next to config.inc.php), create tmp, and assign ownership to the web server user:
cd /var/www/phpmyadmin sudo mkdir -p tmp sudo chown -R www-data:www-data tmp sudo chmod 750 tmp
Then open config.inc.php and append an explicit absolute path (more reliable than relative ./tmp/):
$cfg['TempDir'] = '/var/www/phpmyadmin/tmp/';
(Alternatively, point it to '/tmp/phpmyadmin/' after creating that directory with the same chown.)
Case 2. Installed via apt Package on Debian / Ubuntu
When installed from Debian/Ubuntu repositories, phpMyAdmin keeps its cache directory at /var/lib/phpmyadmin/tmp (and its config at /etc/phpmyadmin/config.inc.php). If ownership broke after an upgrade or switching PHP-FPM users, reset permissions there:
sudo mkdir -p /var/lib/phpmyadmin/tmp sudo chown -R www-data:www-data /var/lib/phpmyadmin/tmp sudo chmod 750 /var/lib/phpmyadmin/tmp
Directory Exists, Yet the Warning Won’t Go Away?
Check these three common culprits:
- Wrong web server / PHP-FPM user. Debian/Ubuntu typically use
www-data, CentOS/Rocky/Alma useapacheornginx, and custom PHP-FPM pools may run under a per-site Linux user. Verify withps aux | grep -E 'php-fpm|apache2|httpd'. - PHP
open_basedirrestriction. If your PHP pool enforcesopen_basedir, make sure the path in$cfg['TempDir']lies inside the allowed paths. - Variable case typo. PHP variables are case-sensitive: it must be lowercase
$cfg['TempDir'](not$Cfg['TempDir']).
Reload phpMyAdmin (Ctrl + F5) – the warning disappears immediately and table pages load noticeably faster.

![phpMyAdmin warning: $cfg['TempDir'] (./tmp/) is not accessible](https://nemcd.com/wp-content/uploads/2019/08/phpmyadmin-tempdir-600x70.png)