phpMyAdmin says the $cfg['TempDir'] directory is not accessible
The $cfg['TempDir'] (./tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.Short answer
phpMyAdmin keeps its template cache in the folder named by $cfg['TempDir'], ./tmp/ by default. The warning means the web server user cannot use that folder: it does not exist, or another user owns it. Create it, make the web server user its owner with mode 700, or point TempDir to a folder that user can write.
Fix it fast
1Find out which cause you have
Find the folder phpMyAdmin is using and see who owns it. Replace the path with your own install directory, and www-data with the user your web server runs as.
ls -ld /usr/share/phpmyadmin/tmp ps -o user= -C apache2 | sort -u2Match what you see, then jump to its fix
- 1
ls reports No such file or directory for the tmp folderThe tmp folder does not existFix - 2
The folder exists, but its owner is root or your login user and the web server user is a different oneThe folder belongs to another userFix - 3
The phpMyAdmin directory is managed by a package or an image, and you cannot write inside itThe install folder is read-only, so TempDir must live elsewhereFix
- 1
What does the error look like?
The $cfg['TempDir'] (./tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.
Cause 1 of 3
The tmp folder does not exist
1Check
The default value is a tmp folder inside the phpMyAdmin directory. A copy made from a download or an archive that skipped empty folders will not have it.
ls -ld /usr/share/phpmyadmin/tmp2Fix
Create the folder and give it to the web server user, with access only for that user.
cd /usr/share/phpmyadmin
sudo mkdir tmp
sudo chown www-data:www-data tmp
sudo chmod 700 tmp3Verify
Reload phpMyAdmin. The warning should be gone.
ls -ld /usr/share/phpmyadmin/tmpConfirmed by docs.phpmyadmin.net
Cause 2 of 3
The folder belongs to another user
1Check
The manual says the directory only needs to be reachable by the web server user, so ownership and mode must match that user.
stat -c '%U:%G %a' /usr/share/phpmyadmin/tmp2Fix
Change the owner to the web server user and set mode 700. If you cannot change the owner, the manual describes giving that group access with setfacl. It names 777 only as the last resort, because other users on the machine could then read the data.
sudo chown www-data:www-data /usr/share/phpmyadmin/tmp
sudo chmod 700 /usr/share/phpmyadmin/tmp3Verify
The stat command now prints www-data:www-data 700.
stat -c '%U:%G %a' /usr/share/phpmyadmin/tmpConfirmed by docs.phpmyadmin.net
Cause 3 of 3
The install folder is read-only, so TempDir must live elsewhere
1Check
TempDir is a normal setting, so it can name any directory the web server user can use.
grep -n "TempDir" /etc/phpmyadmin/config.inc.php /usr/share/phpmyadmin/config.inc.php2Fix
Create a folder outside the install directory with the same owner and mode, then set TempDir to it in config.inc.php.
sudo mkdir -p /var/lib/phpmyadmin/tmp
sudo chown www-data:www-data /var/lib/phpmyadmin/tmp
sudo chmod 700 /var/lib/phpmyadmin/tmp
# in config.inc.php
$cfg['TempDir'] = '/var/lib/phpmyadmin/tmp';3Verify
Reload the page in the browser. The warning no longer shows.
ls -ld /var/lib/phpmyadmin/tmpConfirmed by docs.phpmyadmin.net
How do I stop it coming back?
- After every manual upgrade, check that the tmp folder exists and still has the web server user as owner.
- Keep the mode as strict as possible; only the web server user needs this folder.
- Prefer a TempDir outside the web root when the install directory is managed by a package.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Back end
Apache returns 503 or 504 because PHP-FPM did not answer in time
Error dispatching request
Apache sent the request to PHP-FPM and gave up waiting.
3 causes, each with a fixBack end
Application Load Balancer returns 502 for a Node.js target
HTTPCode_ELB_502_Count
An ALB returns 502 when the target gives it something it cannot use: a refused or reset connection, a connection closed mid-request, a bad response, or a header over 32 K.
4 causes, each with a fixBack end
AWS SDK for PHP cannot get credentials from the instance profile metadata server
Error retrieving credentials from the instance profile metadata server.
The SDK tries the EC2 instance metadata service when it has no valid credentials from anywhere earlier in its chain.
4 causes, each with a fixBack end
AWS SDK for PHP rejects requests: the signature is from the future
Signature not yet current: {date} is still later than {date}
AWS compares the timestamp in your signed request with its own clock.
2 causes, each with a fixBack end
CodeIgniter 4 cannot write its cache files
CodeIgniter\Cache\Exceptions\CacheException: Cache unable to write to /var/www/app/writable/cache/
CodeIgniter 4's file cache needs a cache directory that the web server can really write to.
2 causes, each with a fixBack end
CodeIgniter 3 loads the model but the property is undefined
The model name you are loading is the name of a resource that is already being used: user
CodeIgniter 3 expects a model file named like its class, with the first letter capitalised, for example User_model.php holding class User_model.
2 causes, each with a fix