簡體   English   中英

Phpmyadmin 5.1.0.RC1 & 5.0.4 錯誤(警告在./libraries/classes/Config.php#1285 mkdir(): Permission denied)

[英]Phpmyadmin 5.1.0.RC1 & 5.0.4 error (Warning in ./libraries/classes/Config.php#1285 mkdir(): Permission denied)

我在 ubuntu 服務器 20.04 上測試 phpmyadmin 5.0.4 和 5.1.0.RC1,我收到以下錯誤:

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 (原始“根”)更改 my./libraries/classes/Config.php 和 /var/lib/phpmyadmin/tmp/twig (也創建此文件夾“twig”)的所有者,但是錯誤沒有解決。

我的供應商配置是:

<?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。

謝謝你的支持!

啟用模板緩存。 編輯/usr/share/webapps/phpMyAdmin/config.inc.php添加以下行:

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

資料來源: https://wiki.archlinux.org/index.php/PhpMyAdmin#Enabling_template_caching

有同樣的問題。 通過以下方式解決了它:

  1. 打開vendor_config.php

     sudo nano /usr/share/phpmyadmin/libraries/vendor_config.php
  2. CTRL + W並搜索TEMP_DIR

  3. 將行更改為:

     define('TEMP_DIR', '/var/lib/phpmyadmin/tmp/');
  4. CTRL + W並搜索CONFIG_DIR

  5. 將行更改為:

     define('CONFIG_DIR', '/etc/phpmyadmin/');
  6. 保存文件並退出。 (按CTRL + X 。按Y然后按ENTER

  7. Select 安裝版本: https://www.phpmyadmin.net/files/

  8. 提取/libraries/classes/Config.php文件並將其替換為現有文件。

感謝和問候。

這是對 Saurabh 答案的補充。 我不得不手動創建臨時目錄結構,並添加一個名為“twig”的附加目錄。 所以你可能需要創建:

/var/lib/phpmyadmin/tmp/twig

在按照他們的說明創建臨時目錄后,一切正常。

如果這個問題沒有解決,很可能是因為 apache 用戶不是默認的www-data

當您安裝phpmyadmin時, /var/lib/phpmyadmin/tmp默認歸www-data所有。
因此,如果您更改了 apache 默認用戶,則無法在此目錄中寫入。

修復相當簡單:

chown -R "apache-user:apache-group" /var/lib/phpmyadmin/*
chmod -R g+s /var/lib/phpmyadmin/tmp/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM