首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Phpmyadmin 5.1.0.RC1 & 5.0.4错误( ./libraries/classes/Config.php#1285 mkdir()中的警告:权限被拒绝)

问Phpmyadmin 5.1.0.RC1 & 5.0.4错误( ./libraries/classes/Config.php#1285 mkdir()中的警告:权限被拒绝)
EN

Stack Overflow用户
提问于 2021-01-09 17:29:05
回答 3查看 8K关注 0票数 5

我在ubuntu服务器20.04上测试phpmyadmin 5.0.4和5.1.0.RC1,发现以下错误:

代码语言:javascript
复制
Warning in ./libraries/classes/Config.php#1285
 mkdir(): Permission denied
Backtrace

./libraries/classes/Config.php#1285: mkdir(
string '/usr/share/phpmyadmin//var/lib/phpmyadmin/tmp/twig',
integer 504,
boolean true,
)
./libraries/classes/Template.php#57: PhpMyAdmin\Config->getTempDir(string 'twig')
./libraries/classes/Theme.php#101: PhpMyAdmin\Template->__construct()
./libraries/classes/Theme.php#174: PhpMyAdmin\Theme->__construct()
./libraries/classes/ThemeManager.php#307: PhpMyAdmin\Theme::load(
string './themes/pmahomme',
string '/usr/share/phpmyadmin/./themes/pmahomme/',
)
./libraries/classes/ThemeManager.php#79: PhpMyAdmin\ThemeManager->loadThemes()
./libraries/classes/ThemeManager.php#121: PhpMyAdmin\ThemeManager->__construct()
./libraries/classes/ThemeManager.php#385: PhpMyAdmin\ThemeManager::getInstance()
./libraries/common.inc.php#232: PhpMyAdmin\ThemeManager::initializeTheme()
./index.php#15: require_once(./libraries/common.inc.php)

我尝试通过www-data (原始的"root")更改./libraries/classes/Config.php和/var/lib/phpmyadmin/tmp/twig (也创建了这个文件夹"twig“)的所有者,但错误没有解决。

我的供应商配置是:

代码语言:javascript
复制
<?php
/**
 * File for vendor customization, 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.
 */

declare(strict_types=1);

// phpcs:disable PSR1.Files.SideEffects
if (! defined('PHPMYADMIN')) {
    exit;
}
// phpcs:enable

/**
 * Path to vendor autoload file. Useful when you want to
 * have have vendor dependencies somewhere else.
 */
define('AUTOLOAD_FILE', ROOT_PATH . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php');

/**
 * Directory where cache files are stored.
 */
define('TEMP_DIR', ROOT_PATH . '/var/lib/phpmyadmin/tmp/' . DIRECTORY_SEPARATOR);

/**
 * Path to changelog file, can be gzip compressed. Useful when you want to
 * have documentation somewhere else, eg. /usr/share/doc.
 */
define('CHANGELOG_FILE', ROOT_PATH . 'ChangeLog');

/**
 * Path to license file. Useful when you want to have documentation somewhere
 * else, eg. /usr/share/doc.
 */
define('LICENSE_FILE', ROOT_PATH . 'LICENSE');

/**
 * Directory where SQL scripts to create/upgrade configuration storage reside.
 */
define('SQL_DIR', ROOT_PATH . 'sql' . DIRECTORY_SEPARATOR);

/**
 * 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');

/**
 * Default value for check for version upgrades.
 */
define('VERSION_CHECK_DEFAULT', true);

/**
 * Path to files with compiled locales (*.mo)
 */
define('LOCALE_PATH', ROOT_PATH . 'locale' . DIRECTORY_SEPARATOR);

/**
 * Define the cache directory for routing cache an other cache files
 */
define('CACHE_DIR', ROOT_PATH . 'libraries' . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR);

我使用的是php8.0。

Thx给你后背!

EN

回答 3

Stack Overflow用户

发布于 2021-02-03 03:22:35

启用模板缓存。编辑/usr/share/webapps/phpMyAdmin/config.inc.php以添加行:

代码语言:javascript
复制
$cfg['TempDir'] = '/tmp/phpmyadmin';

来源:https://wiki.archlinux.org/index.php/PhpMyAdmin#Enabling_template_caching

票数 13
EN

Stack Overflow用户

发布于 2021-03-13 06:53:33

这是对Saurabh答案的补充。我不得不手动创建临时目录结构,并添加一个名为"twig“的额外目录。因此,您可能需要创建:

代码语言:javascript
复制
/var/lib/phpmyadmin/tmp/twig

在按照他们的说明创建了临时目录之后,一切都很正常。

票数 5
EN

Stack Overflow用户

发布于 2021-07-30 17:01:24

如果这个问题没有得到解决,很可能是因为apache用户不是默认的www-data。

安装phpmyadmin时,默认情况下,/var/lib/phpmyadmin/tmp归www-data所有。

因此,如果您更改了apache默认用户,它将不能在此目录中写入。

修复相当简单:

代码语言:javascript
复制
chown -R "apache-user:apache-group" /var/lib/phpmyadmin/*
chmod -R g+s /var/lib/phpmyadmin/tmp/
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65641099

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档