nginxphpmyadminblowfish

phpMyAdmin errors while accessing config.inc.php and blowfish_secret.inc.php


i'm running phpMyAdmin 4.6.6deb5 on the following configuration:

phpMyAdmin seems to work, but there's this red error message that says something about the blowfish secret. Somehow there's no way to get rid of it. The error-log contains the following entries:

2020/03/22 21:46:30 [error] 26664#26664: *53 FastCGI sent in stderr: "PHP message: phpmyadmin: Failed to load /var/lib/phpmyadmin/blowfish_secret.inc.php Check group www-data has read access and open_basedir restrictions.
PHP message: phpmyadmin: Failed to load /var/lib/phpmyadmin/config.inc.php Check group www-data has read access and open_basedir restrictions" while reading response header from upstream, client: 87.147.18.48, server: ***, request: "GET /phpmyadmin/js/get_image.js.php?theme=pmahomme&v=4.6.6deb5 HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "***

Both, the folder and the files, are assigned to www-data. I've also assigned the following permissions:

# chmod 755 /var/lib/phpmyadmin
# chmod 664 /var/lib/phpmyadmin/blowfish_secret.inc.php 
# chmod 664 /var/lib/phpmyadmin/config.inc.php 

Doesn't work...

What seems strange to me is the fact that the config.inc.php is empty and the blowfish_seceret.inc.php looks like this:

<?php
$cfg['blowfish_secret'] = 'j(<purKyJl>5D]yzlPoKFLNfH9es6.-T';

It seems like both files are broken. Could anybody tell me where I can find right files? I know that there are several config.inc.php files in different folders, some of them including the line for the blowfish_secret, but I don't know which of them is the right one to copy to /var/lib/phpmyadmin.

I've found similar issues while searchig on stackoverflow and other forums, but none of the suggested solutions worked for me.

Thanks in advance

Best Regards, Boris


Solution

  • There are a couple of odd things about your setup, one of which is that package managers would usually put configuration files in etc/phpmyadmin, not /var/lib/phpmyadmin. In addition, version 4.6.6 is quite old.

    If you want to continue to troubleshoot your existing installation, I suggest you start looking in to whether there are any open _basedir restrictions. Look at the output of phpinfo().

    Create a new text file in your webserver root directory. You can call it whatever you'd like, such as phpinfo.php. The text file should contain

    <?php
    phpinfo();
    

    Load that up in your browser and search the output for open_basedir. That will show what you have configured, and also near the top there's a section that will tell you which configuration files are being read, so you can start guessing where to fix it if there is a misconfiguration.

    Upgrading

    If your PHP and MySQL versions will support it (and PHP 7.2 will, so you are probably okay), I suggest installing the recent version from the phpMyAdmin PPA. You should first remove what you can on your local system of the existing phpMyAdmin package, including the /var/lib/phpmyadmin and /etc/phpmyadmin folders (the usual disclaimer about making a backup first applies even though none of this should be destructive). You may wish to save your configuration file config.inc.php if you've made customizations that you want to keep.

    These should be compatible and updated.

    Easy automatic install

    Probably you only need two lines to add the PPA, then you can search for 'phpmyadmin' with your favorite package managing tool such as aptitude:

    sudo add-apt-repository ppa:phpmyadmin/ppa
    sudo apt-get update
    

    Manual install

    If your system doesn't have apt-repository or something else goes wrong, there are manual instructions there, which are basically this:

    You probably have to add the PPA as an apt source, which you can do with

    sudo echo "deb http://ppa.launchpad.net/phpmyadmin/ppa/ubuntu bionic main" > /etc/apt/sources.list.d/phpmyadmin.list

    Try to update apt: apt-get update. You'll probably get a key error, which we expect because you don't have the proper key to verify downloads yet. When you get the error, note the key ID.

    Retrieve the key: apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 2EA3055293CB3F45 (at the moment, that is the key that I needed, but that could change, so it's better to copy and paste it from the error message and substitute that in this command).

    Finally, you can update the package list again with apt-get update then install the phpmyadmin package with your favorite apt-flavored tool.