After upgrading to php7.2 on Ubuntu 16.04 LTS, phpMyAdmin shows annoying popup warnings when I view tables:
"Some errors have been detected on the server! Please look at the bottom of this window. Ignore All. Ignore."
At the bottom of the window:
"Warning in ./libraries/sql.lib.php#601
count(): Parameter must be an array or an object that implements Countable"
... followed by a long backtrace list.
This problem occurs on various phpMyAdmin 4.x versions including and below 4.5.4.
How do I fix this?
After upgrading to the newest version of phpMyAdmin (4.7.9), I now get a new error that shows up at the bottom of every page:
"The configuration file now needs a secret passphrase (blowfish_secret)."
How do I fix this?
As of writing this, the phpMyAdmin version available in the Ubuntu package manager (4.5.4) does not fully support php7.2, which leads to the annoying count() warning. The solution is to update to the latest phpMyAdmin version, which is 4.7.9 at the time of writing.
The Ubuntu package is behind. There is a phpMyAdmin PPA, but it too is behind:
“Note: This repository is currently a bit behind as I struggle to find time to update it to 4.7 series.”
Fortunately, we can manually upgrade from the older version.
The basic steps are:
These terminal commands should get the job done (use sudo if applicable):
mv /usr/share/phpmyadmin /usr/share/phpmyadmin_old
mkdir /usr/share/phpmyadmin
mkdir /var/downloads
cd /var/downloads
wget https://files.phpmyadmin.net/phpMyAdmin/4.7.9/phpMyAdmin-4.7.9-all-languages.tar.gz
tar -xf phpMyAdmin-4.7.9-all-languages.tar.gz -C /usr/share/phpmyadmin --strip-components=1
(Optional) Replace the wget line with the latest version or preferred format of your choice. Visit https://www.phpmyadmin.net/downloads/.
At this point, you will probably get a blowfish error when you use phpMyAdmin. To resolve this, you should update a specific configuration file:
vendor_config.php
in /usr/share/phpmyadmin/libraries/vendor_config.php
define('CONFIG_DIR', '');
with define('CONFIG_DIR', '/etc/phpmyadmin/');
and save the file.When you are done, lines 33-38 of vendor_config.php
should look something like:
/**
* 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/');
At this point, phpMyAdmin may work without errors, but you might need to add additional length to the blowfish_secret configuration string.
/var/lib/phpmyadmin/blowfish_secret.inc.php
. You should see:
<?php
$cfg['blowfish_secret'] = 'Something Short';
$cfg['blowfish_secret']
string, at least 40 characters and even longer might be better (I use a string as long as 100 characters).For example (don't use this, just an example):
$cfg['blowfish_secret'] = 'A much longer random string 7NfSjYezwmwGCfGDuDO7uWn4ESw2sCFCym1RatPjGCfGCym1RatPjGCfG';
At this point, refresh phpMyAdmin (in your browser) and login again. Everything should work properly now.
If desired, you may remove the backup copy of the old phpMyAdmin version with:
rm -rfv /usr/share/phpmyadmin_old
Additional Documentation
For reference, the following are excerpts from the official phpMyAdmin documentation about manually updating to the latest version (this is not Ubuntu specific):
Warning
Never extract the new version over an existing installation of phpMyAdmin, always first remove the old files keeping just the configuration.
This way you will not leave old no longer working code in the directory, which can have severe security implications or can cause various breakages.
And:
The complete upgrade can be performed in few simple steps:
Download the latest phpMyAdmin version from https://www.phpmyadmin.net/downloads/.
Rename existing phpMyAdmin folder (for example to phpmyadmin-old).
Unpack freshly donwloaded phpMyAdmin to desired location (for example phpmyadmin).
Copy config.inc.php` from old location (phpmyadmin-old) to new one (phpmyadmin).
Test that everything works properly.
Remove backup of previous version (phpmyadmin-old).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With