Error in phpMyAdmin after updating to v4.8.0: The

2019-03-09 01:11发布

问题:

phpMyAdmin worked fine with v4.7.9. Now after updating to v4.8.0 today (replacing the old phpmyadmin 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?

回答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.



回答2:

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'].



回答3:

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



回答4:

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';


回答5:

Create a tmp folder in the base directory of the phpMyAdmin install (e.g. /usr/share/phpmyadmin/tmp), and make sure that it is writable by the user that PHP is running under.



回答6:

From the phpMyAdmin documentation:

$cfg['TempDir']
    Type:   string
    Default value:  './tmp/'

The name of the directory where temporary files can be stored. It is used for several purposes, currently:

The templates cache which speeds up page loading. ESRI Shapefiles import, see 6.30 Import: How can I import ESRI Shapefiles?.

To work around limitations of open_basedir for uploaded files, see 1.11 I get an ‘open_basedir restriction’ while uploading a file from the import tab..

This directory should have as strict permissions as possible as the only user required to access this directory is the one who runs the webserver. If you have root privileges, simply make this user owner of this directory and make it accessible only by it:

chown www-data:www-data tmp
chmod 700 tmp

If you cannot change owner of the directory, you can achieve a similar setup using ACL:

chmod 700 tmp
setfacl -m "g:www-data:rwx" tmp
setfacl -d -m "g:www-data:rwx" tmp

If neither of above works for you, you can still make the directory chmod 777, but it might impose risk of other users on system reading and writing data in this directory.



回答7:

In my case [MacOs El Capitán/portuguese], the message was:

The $cfg['TempDir'] (./temp/) is not accessible

My solution, in xamppfiles/phpmyadmin/config.inc.php:

$cfg['TempDir'] = './temp/'; to $cfg['TempDir'] = '../temp/';

That is, I just added a point to the path... work's fine.



回答8:

I had a similiar problem, with the "temp" directory. The solution was to change the owner and group of the "twig" directory (inside "temp") to "apache" (both owner and group)



回答9:

1) create the tmp folder

mkdir /usr/share/phpmyadmin/tmp

2) findout your php user

<?php echo `whoami`; ?>

3) Change ownership of the tmp folder to the php user found in step 2

sudo chown -R step2phpuser:step2phpuser /usr/share/phpmyadmin/tmp

4) Signout of phpmyadmin and sign back in



回答10:

well,in my case this error has occured when i was using ubuntu 18.04. All you need is to go to the installation directory (in ubuntu - opt/lampp/phpmyadmin) and create a folder tmp with all the suitable read/write permissions.

Follow these steps in case of ubuntu-

1.go to the PMA installation directory by typing following commands in cmd-

cd opt/lampp/phpmyadmin

2.Then type the following command-

sudo mkdir tmp && chmod 777 tmp

and then you are done..!! I hope it helps..



回答11:

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.



回答12:

I just changed my vendor_config.php file to define('TEMP_DIR', '/tmp/'); instead of define('TEMP_DIR', './tmp/');

This seems to work.



回答13:

My Answer goes to centos 7 Sentora users, tmp folder has to be created under phpMyadmin of Sentora as shown below

cd /etc/sentora/panel/etc/apps/phpmyadmin/
sudo mkdir tmp

After creating the folder make sure you give Apache access permissions to the tmp folder

chown -R apache /etc/sentora/panel/etc/apps/phpmyadmin/tmp/



回答14:

simply go to the phpmyadmin folder and put this code

$cfg['TempDir'] = './tmp/';

and then check tmp folder is exists or not into phpmyadmin if not exists then create tmp folder and give read and right permission to it.



回答15:

I had the same error message. I'm using Ubuntu16.04 with lampp. You should go to 'phpmyadmin' directory, in my case '/opt/lampp/phpmyadmin/', create a new 'tmp' folder. Open a terminal window and:

cd YOUR_PATH_TO_PHPMYADMIN
sudo mkdir tmp

Now you have to change the group of the 'tmp' folder to give access to php user. In order to find it, you can create a php file inside your localhost directory, in my case 'htdocs'

sudo touch user.php
sudo nano user.php

Inside nano editor, type:

<?php echo `whoami`; ?>

Then press CTRL + O and CTRL + X to save and exit. Open the browser and type in your address bar

localhost/user.php

It shows your php user.

After that, go to the terminal and navigate to your recently created 'tmp' directory inside phpmyadmin directory and type:

sudo chgrp YOUR_PHP_USER tmp -R

And change the permission to the 'tmp' directory:

sudo chmod 775 tmp -R

I recommend never give 777 permission to any file.

I hope it helps!



回答16:

Create the tmp folder in the root of phpmyadmin files

In addition to that, you also need to provide all permissions to that folder. That's what I did in Windows.