skip to Main Content

Hi I am having trouble with phpmyadmin.
It is basicly a fresh installed version. I cannot figure out why this does not work. I did not modify any of the files yet.

It show following error messages when logged in:

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: -

As mentioned above I did not modify blowfish secret or any other files
ls /var/lib/phpmyadmin/

blowfish_secret.inc.php  tmp

Also the configuration file looks correct. I even tried to change the path a little bit to see if it has any effect and is the correct configuration file. It shows the same error but with the new path.

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

/**

4

Answers


  1. Looking at the code, I see that the message appears about tmp directory when phpmyadmin cannot access twig temp directory. This means that /var/lib/phpmyadmin/tmp/ may be accessible but /var/lib/phpmyadmin/tmp/twig may not (e.g. wrong permissions or missing).

    It could also be that twig temp directory is not under /var/lib/phpmyadmin/tmp/ because to access it they use: $this->config->getTempDir('twig'), but to report the error about tmp dir path they use: $this->config->get('TempDir').

    See below:

            if ($this->config->getTempDir('twig') === null) {
                trigger_error(
                    sprintf(
                        __(
                            'The $cfg['TempDir'] (%s) is not accessible. ' .
                            'phpMyAdmin is not able to cache templates and will ' .
                            'be slow because of this.'
                        ),
                        $this->config->get('TempDir')
                    ),
                    E_USER_WARNING
                );
            }
    

    TLDR: The message is probably misleading. You should check whether twig cache directory is accessible (ownership/permissions).

    Login or Signup to reply.
  2. Could you please check permission of directory /var/lib/phpmyadmin. tmp seems correct permissions.

    ls -ld /var/lib/phpmyadmin

    above directory should be 755 permission atleast or ownership of same user which is using for webserver as well.

    and check if selinux enabled by below command

    getenforce

    Login or Signup to reply.
  3. I ran in to this issue setting up PhpMyAdmin Version 5.1.0 on a LEMP stack. Distribution is Fedora 33 and all software is using the default repositories.

    I have found the installation defaults vary heavily between distributions, and had some trouble getting it setup for my particular arrangement. Largely, this was due to conflicting information I found during troubleshooting.

    I say this because the real solution for the problem depends on setting the proper directory owner and path based on your installation.

    In my installation, the $PMA-DIR/config.inc.php has the working directories existing in /var/lib/phpMyAdmin/.
    So the error I received logging in read:

    The $cfg['TempDir'] (/var/lib/phpMyAdmin/temp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.

    So I checked the details for the main PMA directory there:
    ls -l /var/lib/phpMyAdmin
    Which resulted in:

    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
    

    If I was using httpd for the webserver this would have been fine. However, I am running nginx so I needed to change ownership, respectively:

    chown -R nginx:nginx /var/lib/phpMyAdmin

    And now I can see that ls -l /var/lib/phpMyAdmin/ shows:

    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
    

    And just to be sure that phpMyAdmin and I were really talking about the same directory, I edited my $PMA-DIR/config.inc.php and modified the relevant section to look like this:

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

    After reloading nginx and refreshing, the error is gone for me.

    For your use case it may very well be that you have a different user than what is required.
    I have seen many guides that have listed the user as www-data, but in some cases, the user is nobody/apache/httpd.

    To find the proper one you could run something like ps aux | egrep '(apache|apache2|httpd|nginx)'.
    The first field in the results should be the right owner.
    Apply it to the correct path with chown as demonstrated above.

    If you set the rest of your configuration already and are still having the Blowfish setting error after this; then you may have a separate folder for the main configuration that will need ownership changed, as well.

    For me it was due to the Fedora install using /etc/phpMyAdmin directory as the main config directory.
    It was owned by apache. After setting it to nginx, the blowfish error was also gone.

    TL;DR: Solved on Fedora 33 with LEMP(Nginx) by using:

    chown -R nginx:nginx /var/lib/phpMyAdmin

    and

    chown -R nginx:nginx /etc/phpMyAdmin

    Login or Signup to reply.
  4. Let’s assume what are causes for this messge.

    1. May be the folder path is not exists.
    2. May be the folder exists but phpmyadmin have no permission to access this file
    3. My be folder exists and phpmyadmin can read file but can’t write file which is required to store twig compiled files.

    This are so far I faced when configuring phpmyadmin application.
    Now how to solve this:

    1. If folder path doesn’t exist then just create those folder path . If you are on linux try this
      mkdir -p /var/lib/phpmyadmin/tmp/twig
    2. If you already have a folder path or just created you need to set file permission and acess permission. For simplicity try this commands
    • cd /var/lib
    • sudo chmod -R 775 phpmyadmin/
      this set read and write file permission.
    1. Setting the user read write permission for phpmyadmin. It’s bit different for different web server and os. I will share how to fix this on apache web server
    • First check what user and group run to apache server. you can check it by opening this /etc/apache2/envvars file. look for values of APACHE_RUN_USER, APACHE_RUN_GROUP
    • Now we know which user and group are assigned web server. we have to set user permission to that user and group.
    • cd /var/lib
    • sudo chown -R APACHE_RUN_USER_VALUE:APACHE_RUN_GROUP_VALUE phpmyadmin/
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search