This is an emergency post, because there is a new version of phpMyAdmin released and I didn’t realize it until I accessed the phpMyAdmin page.
Introduction
I have tested this guide on Ubuntu 22.04 running PHP 8.2. It may also work for older configurations. If you have any issues, please Googling for it.
1. Back up phpMyAdmin
Back up your current phpMyAdmin folder by renaming it.
sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin.bak
Create a new phpMyAdmin folder.
sudo mkdir /usr/share/phpmyadmin/
CD to directory.
cd /usr/share/phpmyadmin/
2. To obtain phpMyAdmin 5.2.1 (released in Feb 2023), you need to download and extract it.
Please note that this version of phpMyAdmin necessitates PHP 7.2 or later. If you are unsure of your PHP version, you can check it by running the command php -v in the command line.
Head over to the phpMyAdmin download page and locate the .tar.gz URL. Download it using wget. For this tutorial, we’ll be using version 5.2.1, which was released in February 2023. If a newer version is available, make sure to modify the commands provided below accordingly.
Download phpMyAdmin.
sudo wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.tar.gz
Extract.
sudo tar xzf phpMyAdmin-5.2.1-all-languages.tar.gz
List folder using ls
. You should see a new folder phpMyAdmin-5.2.1-all-languages.
We want to move the contents of this folder to /usr/share/phpmyadmin
sudo mv phpMyAdmin-5.2.1-all-languages/* /usr/share/phpmyadmin
You can now log back into phpMyAdmin and check the current version. You may also see two errors:
3. Fixing phpMyAdmin Errors
3.1. How to fix “The configuration file needs a valid key for cookie encryption” error
If you encounter the error message “The configuration file needs a valid key for cookie encryption. A temporary key was automatically generated for you. Please refer to the documentation,” it means you need to create a unique key for your phpMyAdmin installation.
phpMyAdmin loads /usr/share/phpmyadmin/libraries/config.default.php first, and then it overrides any values with those found in /usr/share/phpmyadmin/config.inc.php. To create the config file, you can simply create a file named config.inc.php by moving config.sample.inc.php to config.inc.php
sudo mv config.sample.inc.php config.inc.php
And we can edit it using nano
sudo nano config.inc.php
Generate a 32-character blowfish secret and paste it below to create a file that looks similar to the example provided.
Save and exit (press CTRL
 + X
, press Y
 and then press ENTER
)
Log back into phpMyAdmin and check that the error is gone.
3.2. $cfg[‘TempDir’] (/usr/share/phpmyadmin/tmp/) is not accessible error
If you are seeing an error The $cfg[‘TempDir’] (/usr/share/phpmyadmin/tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.
You need to create this directory and make it writable.
sudo mkdir /usr/share/phpmyadmin/tmp && sudo chmod 777 /usr/share/phpmyadmin/tmp
Log back into phpMyAdmin and check that the error is gone.
4.Cleanup
You can now delete the tar.gz file and the empty folder.
sudo rm /usr/share/phpmyadmin/phpMyAdmin-5.2.1-all-languages.tar.gz
sudo rm -rf /usr/share/phpmyadmin/phpMyAdmin-5.2.1-all-languages
And if you’re certain your new phpMyAdmin install is working correctly you can delete the backup folder.
sudo rm -rf /usr/share/phpmyadmin.bak
That’s all, I hope it works. If not, please ask Google. See you next time. Val, you must remain strong and not give up against your broken heart. You can do it.