Linux Phpmyadmin 4.9.5->;$cfg[';TempDir';](/var/lib/phpmyadmin/tmp/)不可访问,即使它存在并且具有相应的权限
嗨,我和phpmyadmin有麻烦。 它基本上是一个新安装的版本。我不明白为什么这不起作用。我还没有修改任何文件 登录时会显示以下错误消息:Linux Phpmyadmin 4.9.5->;$cfg[';TempDir';](/var/lib/phpmyadmin/tmp/)不可访问,即使它存在并且具有相应的权限,linux,ubuntu,phpmyadmin,Linux,Ubuntu,Phpmyadmin,嗨,我和phpmyadmin有麻烦。 它基本上是一个新安装的版本。我不明白为什么这不起作用。我还没有修改任何文件 登录时会显示以下错误消息: The configuration file now needs a secret passphrase (blowfish_secret). The $cfg['TempDir'] (/var/lib/phpmyadmin/tmp/) is not accessible. phpMyAdmin is not able to cache template
The configuration file now needs a secret passphrase (blowfish_secret).
The $cfg['TempDir'] (/var/lib/phpmyadmin/tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.
stat/var/lib/phpmyadmin/tmp
File: /var/lib/phpmyadmin/tmp
Size: 4096 Blocks: 8 IO Block: 4096 directory
Device: 803h/2051d Inode: 170769 Links: 3
Access: (0777/drwxrwxrwx) Uid: ( 33/www-data) Gid: ( 33/www-data)
Access: 2020-09-07 02:26:51.239765744 +0200
Modify: 2020-06-26 03:45:53.392552054 +0200
Change: 2020-09-07 02:34:01.222889412 +0200
Birth: -
如上所述,我没有修改河豚秘密或任何其他文件
ls/var/lib/phpmyadmin/
blowfish_secret.inc.php tmp
此外,配置文件看起来也正确。我甚至试着稍微更改一下路径,看看它是否有任何效果,是否是正确的配置文件。它显示相同的错误,但使用新路径
sudo nano/usr/share/phpmyadmin/libraries/vendor_config.php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* File for vendor customisation, you can change here paths or some behaviour,
* which vendors such as Linux distributions might want to change.
*
* For changing this file you should know what you are doing. For this reason
* options here are not part of normal configuration.
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* Path to vendor autoload file. Useful when you want to
* have have vendor dependencies somewhere else.
*/
define('AUTOLOAD_FILE', './autoload.php');
/**
* Directory where cache files are stored.
*/
define('TEMP_DIR', '/var/lib/phpmyadmin/tmp/');
/**
* Path to changelog file, can be gzip compressed. Useful when you want to
* have documentation somewhere else, eg. /usr/share/doc.
*/
define('CHANGELOG_FILE', '/usr/share/doc/phpmyadmin/changelog.gz');
/**
* Path to license file. Useful when you want to have documentation somewhere
* else, eg. /usr/share/doc.
*/
define('LICENSE_FILE', '/usr/share/doc/phpmyadmin/copyright');
/**
* Directory where SQL scripts to create/upgrade configuration storage reside.
*/
define('SQL_DIR', './sql/');
/**
* Directory where configuration files are stored.
* It is not used directly in code, just a convenient
* define used further in this file.
*/
define('CONFIG_DIR', '/etc/phpmyadmin/');
/**
* Filename of a configuration file.
*/
define('CONFIG_FILE', CONFIG_DIR . 'config.inc.php');
/**
* Filename of custom header file.
*/
define('CUSTOM_HEADER_FILE', CONFIG_DIR . 'config.header.inc.php');
/**
* Filename of custom footer file.
*/
define('CUSTOM_FOOTER_FILE', CONFIG_DIR . 'config.footer.inc.php');
/**
查看,我看到当phpmyadmin无法访问twig
temp目录时,出现了关于tmp
目录的消息。这意味着可以访问/var/lib/phpmyadmin/tmp/
,但/var/lib/phpmyadmin/tmp/twig
可能无法访问(例如,权限错误或丢失)
也可能是twig
temp目录不在/var/lib/phpmyadmin/tmp/
下,因为要访问它,他们使用:$this->config->getTempDir('twig')
,但要报告有关tmp
目录路径的错误,他们使用:$this->config->get('TempDir')
见下文:
if($this->config->getTempDir('twig')==null){
触发错误(
斯普林特(
__(
“无法访问$cfg[\'TempDir\'](%s)。”。
“phpMyAdmin无法缓存模板,将”。
“所以要慢一点。”
),
$this->config->get('TempDir')
),
用户警告
);
}
TLDR:这条信息可能有误导性。您应该检查twig缓存目录是否可访问(所有权/权限)。查看,当phpmyadmin无法访问twig临时目录时,我看到出现关于tmp
目录的消息。这意味着可以访问/var/lib/phpmyadmin/tmp/
,但/var/lib/phpmyadmin/tmp/twig
可能无法访问(例如,权限错误或丢失)
也可能是twig
temp目录不在/var/lib/phpmyadmin/tmp/
下,因为要访问它,他们使用:$this->config->getTempDir('twig')
,但要报告有关tmp
目录路径的错误,他们使用:$this->config->get('TempDir')
见下文:
if($this->config->getTempDir('twig')==null){
触发错误(
斯普林特(
__(
“无法访问$cfg[\'TempDir\'](%s)。”。
“phpMyAdmin无法缓存模板,将”。
“所以要慢一点。”
),
$this->config->get('TempDir')
),
用户警告
);
}
TLDR:这条信息可能有误导性。您应该检查细枝缓存目录是否可访问(所有权/权限)。请检查目录/var/lib/phpmyadmin的权限。tmp似乎是正确的权限 ls-ld/var/lib/phpmyadmin 上面的目录至少应该是755权限,或者是Web服务器使用的同一用户的所有权 并检查selinux是否通过以下命令启用 getenforce
请检查/var/lib/phpmyadmin目录的权限。tmp似乎是正确的权限 ls-ld/var/lib/phpmyadmin 上面的目录至少应该是755权限,或者是Web服务器使用的同一用户的所有权 并检查selinux是否通过以下命令启用 getenforce
我在LEMP堆栈上设置PhpMyAdmin 5.1.0版时遇到了这个问题。发行版是Fedora33,所有软件都使用默认存储库 我发现不同发行版之间的安装默认值差别很大,在为我的特定安排进行安装时遇到了一些困难。很大程度上,这是因为我在故障排除过程中发现了相互冲突的信息 我这样说是因为问题的真正解决方案取决于根据您的安装设置正确的目录所有者和路径 在我的安装中,
$PMA-DIR/config.inc.php
的工作目录位于/var/lib/phpMyAdmin/
中。
因此,我在登录时收到的错误为:
无法访问$cfg['TempDir'](/var/lib/phpMyAdmin/temp/)。phpMyAdmin无法缓存模板,因此速度会很慢。
因此,我检查了主PMA目录的详细信息:
ls-l/var/lib/phpMyAdmin
这导致:
drwxr-x--- 2 apache apache 4096 Apr 6 02:25 cache
drwxr-x--- 2 apache apache 4096 Mar 16 13:29 config
drwxr-x--- 2 apache apache 4096 Mar 16 13:29 save
drwxr-x--- 3 apache apache 4096 Apr 6 13:58 temp
drwxr-x--- 2 apache apache 4096 Mar 16 13:29 upload
如果我在Web服务器上使用httpd
,这会很好。但是,我正在运行nginx,因此我需要分别更改所有权:
chown-R nginx:nginx/var/lib/phpMyAdmin
现在我可以看到ls-l/var/lib/phpMyAdmin/
显示:
drwxr-x--- 2 nginx nginx 4096 Apr 6 02:25 cache
drwxr-x--- 2 nginx nginx 4096 Mar 16 13:29 config
drwxr-x--- 2 nginx nginx 4096 Mar 16 13:29 save
drwxr-x--- 3 nginx nginx 4096 Apr 6 13:58 temp
drwxr-x--- 2 nginx nginx 4096 Mar 16 13:29 upload
为了确保phpMyAdmin
和我谈论的是同一个目录,我编辑了我的$PMA-DIR/config.inc.php
并修改了相关部分,如下所示:
/**
* Directories for saving/loading files from server
*/
$cfg['UploadDir'] = '/var/lib/phpMyAdmin/upload';
$cfg['SaveDir'] = '/var/lib/phpMyAdmin/save';
$cfg['TempDir'] = '/var/lib/phpMyAdmin/temp';
重新加载nginx
并刷新后,我的错误消失了
对于您的用例,很可能您有一个不同于所需的用户。
我见过许多指南将用户列为www-data
,但在某些情况下,用户是nobody
/apache
/httpd
要找到合适的,您可以运行类似于psa的程序