A lot of us devs have been having compatibility issues with the latest versions of php (7.2 <) and phpMyadmin. And because of this we’re bugged with the annoying warnings whenever we open phpMyAdmin on our development machines. To get away with this, the only real solution is to update our copy of phpMyAdmin to the latest version. And in this article, we’ll show you how.
1. The first thing to do is to backup your copy of phpMyAdmin.
You can do this by renaming it;
$ sudo mv /usr/share/phpmyadmin /usr/share/phpmyadmin.bak
Create a new folder where to install the latest version;
$ sudo mkdir /usr/share/phpmyadmin
And then change into that directory;
$ cd /usr/share/phpmaydmin
2. Download and extract the latest version of phpMyAdmin
As of this writing, the latest version is 5.0.2. This version of phpMyAdmin is only compatible with php 7.1 and above. You can check your version of php using this command;
$ php -v
If using php < 7.1, use phpMyAdmin 4.9.4. Users are encouraged to migrate to version 5.* of phpMyAdmin. We’ll download it using wget. The wget package is pre-installed on most Linux distributions today. To check whether the wget package is installed on your system, open up your console, type wget , and press enter. If you have wget installed, the system will print wget: missing URL , otherwise, it will print wget command not found.
To download a copy of phpMyAdmin type;
$ sudo wget https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-all-languages.tar.gz
Then extract by using;
$ sudo tar xzf phpMyAdmin-5.0.2-all-languages.tar.gz
After extracting, you should see a folder named phpMyAdmin-5.0.2-all-languages in the current directory. The contents of this folder should be moved to /usr/share/phpmyadmin directory.
To do that, type;
$ sudo mv phpMyAdmin-5.0.2-all-languages/* /usr/share/phpmyadmin
Once copied, you can now go to your browser and check the phpMyadmin page. Your url might be like http://localhost/phpmyadmin.
Login using your db credentials and you should be able to get to the dashboard. From there, you can check the current version of phpMyAdmin and you might notice a couple of errors at the bottom.
The two errors you’ll see may be these two:
1. The $cfg[‘TempDir’] (./tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.
2. The configuration file now needs a secret passphrase (blowfish_secret).
These are both configuration errors. The blowfish secret is used by phpMyAdmin for cookie authentication.
To rectify these errors, we’ll need to edit phpMyAdmin’s vendor_config.php file.
Open the file using this command;
$ sudo nano /usr/share/phpmyadmin/libraries/vendor_config.php
Once opened, search for TEMP_DIR by pressing CTRL+W and then typing TEMP_DIR. Cursor will bring you to the line where TEMP_DIR is, change this line to;
define('TEMP_DIR', '/var/lib/phpmyadmin/tmp/');
Press CTRL+W again and this time search for CONFIG_DIR. Once found, change the line to;
define('CONFIG_DIR', '/etc/phpmyadmin/');
Save the file and exit by pressing CTRL+X and then selecting Y then ENTER.
phpMyAdmin will now generate its blowfish secret based on the install directory.
Log back in to phpMyAdmin and there should no errors at the bottom. And when opening databases and tables, there should be no more warning messages bugging you.
3. Cleaning up
If everything is working out good. Then its time to clean up.
We’ll need to delete the downloaded zipped file, the extracted contents and then the backup we created since we won’t be needing them anymore.
In no particular order, execute the following commands to delete them.
$ sudo rm /usr/share/phpmyadmin/phpMyAdmin-5.0.2-all-languages.tar.gz
$ sudo rm -rf /usr/share/phpmyadmin/phpMyAdmin-5.0.2-all-languages
$ sudo rm -rf /usr/share/phpmyadmin.bak
And that’s it!
Please note that using phpMyAdmin in a production environment is not advisable. But if you are and need to do it, you need to make sure extra security is placed.