Error in phpMyAdmin after updating to v4.8.0: The $cfg['TempDir'] (./tmp/) is not accessible
Solution 1
Solution was to create a folder called tmp
like this: /usr/share/phpmyadmin/tmp
.
Also make sure that the user (or group) running the webserver (e.g. Apache) has write access to the newly created tmp folder. Consequently, change the ownership to that user or add write access for all users. The latter one might not be really advisable.
Solution 2
simple fix is to create tmp dir in your phpmyadmin dir and set permission to 777
mkdir tmp && chmod 777 tmp
then
update your config.inc.php file add that line
$cfg['TempDir'] = 'tmp';
Solution 3
I had this same problem on Ubuntu 18.04 when I replaced the phpMyAdmin version from the package repository (v4.6.6) with the latest version (4.8.0). I don't know if you are running on Ubuntu, but maybe my response will be helpful to you (or others) who encounter something similar.
I put the new version in the standard location, /usr/share/phpmyadmin/
, but Ubuntu's package installation of PMA puts some configuration settings in other places (see /etc/phpmyadmin/
and /var/lib/phpmyadmin/
). I found this setting in /etc/phpmyadmin/apache.conf
:
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
and sure enough that directory had been created and had the proper permissions. Wanting to stay as close as possible to the package installation settings, I made this change in /usr/share/phpmyadmin/libraries/vendor_config.php
and pointed directly to that folder:
//define('TEMP_DIR', './tmp/');
define('TEMP_DIR', '/var/lib/phpmyadmin/tmp/');
This setting is picked up by /usr/share/phpmyadmin/libraries/config.default.php
(which you are not supposed to edit) to set $cfg['TempDir']
.
Solution 4
In my case I added
$cfg['TempDir'] = '/usr/share/phpmyadmin/temp';
to the
config.inc.php File within the phpmyadmin folder
Hope it will help someone
Solution 5
Create a temp directory owned by and restricted to the webserver user. Do not place it inside of the phpMyAdmin webroot. (In this example, the webserver runs as apache
):
mkdir -p /var/tmp/phpMyAdmin
chown apache:apache /var/tmp/phpMyAdmin
chmod 700 /var/tmp/phpMyAdmin
Next, set TempDir
inside of phpMyAdmin's config.inc.php
:
$cfg['TempDir'] = '/var/tmp/phpMyAdmin';
Any answer suggesting that you create /usr/share/phpmyadmin/tmp
is advocating bad security practice. This is generally true for temp directories, and explicitly stated in the official phpMyAdmin documentation:
For security reasons, all directories should be outside the tree published by webserver.
David
Updated on July 05, 2022Comments
-
David almost 2 years
phpMyAdmin
worked fine with v4.7.9. Now after updating to v4.8.0 today (replacing the oldphpmyadmin
folder against the new one) I'm getting this message in phpMyAdmin:The $cfg['TempDir'] (./tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.
I added the folder
./tmp/
like like this:/usr/share/tmp
phpMyAdmin is on:
/usr/share/phpmyadmin
This didn't change anything.
Who know this error? What can I do?
-
Fabius about 6 yearsThis seems not be not working on Amazon EC2 instance running AMI Linux with manually installed phpMyAdmin. I tried to give the whole
/usr/share/phpmyadmin
folder, subfolders and fileschown
andsetfacl
toapache
group and evenchmod
777 to/usr/share/phpmyadmin/tmp
but still get error. The only way to make it work is to set$cfg['TempDir'] = '/tmp';
inconfig.inc.php
but i'm not sure if this is the best way to manage it -
David about 6 years
i'm not sure if this is the best way to manage it
; I think it doesn't matter. It's okay to do it this way. -
Oki Erie Rinaldi about 6 yearsI can't find
config.inc.php
. I only see the 'sample' of it. -
David about 6 years
config.inc.php
should be in phpMyAdmin folder. Maybe it's in/etc/phpmyadmin/config.inc.php
? -
Martin Schneider about 6 years
/var/www/pma# chown www-data tmp
and anychmod 7__
did it -
Fabius about 6 yearsFigured out it was due to SELinux. Tested it by giving
chcon -R -t httpd_sys_rw_content_t /usr/share/phpmyadmin/tmp
command, afterchmod 777 /usr/share/phpmyadmin/tmp
. No more errors reported on phpMyAdmin page. So i made the change permanent withsemanage fcontext -a -t httpd_sys_rw_content_t "/usr/share/phpmyadmin/tmp(/.*)?"
and rebooted. Ensured that the context was assigned proper permissions by checkingtmp
directory's line withls -Z /usr/share/phpmyadmin | grep tmp
. Error seems definitely gone. -
Ishimwe Aubain Consolateur about 6 yearsRemember to add required permissions if required.
-
ssaltman about 6 years/usr/share/phpmyadmin/tmp (not temp) unless you added the folder that way
-
shanehoban about 6 yearsConfirming it worked for me also on Ubuntu 18.04 - upgrading from 4.6.6 to 4.8.0
-
Ishimwe Aubain Consolateur about 6 yearsfolder was added just that way
-
skolind about 6 yearsI did this, but added
$cfg['TempDir'] = '/tmp';
to the config file. -
Peter VARGA almost 6 yearsYou were right. I added it as feature request
-
Braconnot_P over 5 yearsThe default config is config.sample.inc.php, phpMyAdmin will work out of the box with this. Copy to config.inc.php to override it.
-
Deividson Damasio about 5 years@Fabius your comment about SElinux could be added in the reply. It work for me. Thank you.
-
suther about 5 yearsAdditional to @Fabius comment (which work for me), I figured out, that this TempDir issue are also caused of symlink (in my case). I've created an symlink from phpmyadmin to current Version (phpMyAdmin4.xxx.xx). Thats let me easily switch the Version as long as I test the installation. If your vhost point to this symlink, phpmyadmin has trouble to found ./tmp. So do it like Fabius suggest, add the Variable to config.inc.php and all works as expected. Thanks Fabius.
-
user5248 over 4 yearsahhhh. nice. Worked like a champ.
-
TechnoCat over 4 yearsAs per the suggestion from @skolind, the line for me was
$cfg['TempDir'] = '/tmp';
. Problem has now been fixed. Thanks! -
William Ardila about 4 yearsAlso change
define('CONFIG_DIR', ROOT_PATH);
todefine('CONFIG_DIR', '/etc/phpmyadmin/');
in thevendor_config.php
file to get rid of the secret passphrase (blowfish_secret) error -
KEMBL about 4 yearsCentos8, after semanage changes, do not forget to apply them: restorecon -Rv '/usr/share/phpmyadmin/tmp'
-
Kevin C over 3 yearsThis is insecure, as you're giving other users the possibility to read the tmp files. This could lead to data being stolen.
-
Forever Cuber about 3 yearsFor permissions issues on the directories,
777
gives every user full access to the directory. All you really need to do ischown -R user:user ~/phpMyAdmin
whereuser
is the name of the webserver user serving PMA; i.e.www-data
/nginx
/apache
. This will solve any ownership conflicts in the total installation includingtmp
, without giving permissions to everyone. -
Timo over 2 years@Fabius
i'm not sure if this is the best way to manage it
. Works for me, so keep cool, I understand that setting the tmp dir to /tmp works because the user who is logged in to pma is owner of /tmp .