Sometimes the repository response time becomes slow and does not deliver the updates. Or you might be facing compatibility issues with your current version of phpMyAdmin.
Whatever the reason, this tutorial is going to show how you can update your phpMyAdmin to the latest version manually.
Table of Contents
BackUp phpMyAdmin Folder
The first step is to back up the phpMyAdmin folder already present on your system, so you don’t end up losing any data. This is done by changing the name of the phpMyAdmin folder. Run the below command to do this.
If you are installing phpMyAdmin for the first time, you can skip this step.
sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin.bak
Create a New phpMyAdmin Folder
Now we are going to create a new folder for phpMyAdmin. To create a new folder, execute the below command.
sudo mkdir /usr/share/phpmyadmin/
Then CD to the newly created folder directory so that we can install MyPhpAdmin in this directory. The below command will change the directory to this folder.
cd /usr/share/phpmyadmin/
Download phpMyAdmin
Now we are going to download the phpMyAdmin. The latest version available as of now is the phpMyAdmin 5.2.0, which requires PHP 7.2 or newer to run.
Visit the phpMyAdmin Download Page and look for the latest .tar.gz
file and copy its URL. Then we can use the wget
command along with this URL to download this zip file.
For this tutorial, we are going to download version 5.2.0. So the wget
command to do this will look like the one shown below.
sudo wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.tar.gz
Execution of the above command will download the defined version tar.gz
file.
Extract the phpMyAdmin File
Now we need to extract the downloaded .tar.gz
file. By running the command below, we extract the downloaded file.
sudo tar xzf phpMyAdmin-5.2.0-all-languages.tar.gz
Now to confirm whether phpMyAdmin was extracted successfully or not, you can ls in the current directory and check if a new folder has been added or not.
ls
A new folder by the name of phpMyAdmin-5.2.0-all-languages should be present in the directory.
We are going to move this folder to the /usr/share/phpmyadmin
directory. Running the below command will achieve this.
sudo mv phpMyAdmin-5.2.0-all-languages/* /usr/share/phpmyadmin
Now you can log back into phpMyAdmin and check the current version to confirm if it was updated to the latest version or not.
Common Errors
Let’s take a look at some common errors that users face while upgrading their phpMyAdmin to the latest version and how we can resolve these errors.
The “$cfg[‘TempDir’] (./tmp/) is not accessible” Error
If you see an error message stating that "The $cfg['TempDir'] (/usr/share/phpmyadmin/tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.
The directory is not accessible, so we are going to create this directory manually and then make it writable for phpMyAdmin. The execution of the below command will achieve this.
sudo mkdir /usr/share/phpmyadmin/tmp && sudo chmod 777 /usr/share/phpmyadmin/tmp
Now log back into phpMyAdmin and check whether the error is gone or not.
OR
If this error is still present, open the vendor_config.php
file in the nano text editor by running the below line.
sudo nano /usr/share/phpmyadmin/libraries/vendor_config.php
Then press Ctrl+W and search for TEMP_DIR
.
Change this line to the following one.
define('TEMP_DIR', '/var/lib/phpmyadmin/tmp/');
Press Ctrl+X then type Y and press Enter to save and exit.
The “blowfish_secret” Error
You might see an error message stating that The configuration file now needs a secret passphrase (blowfish_secret).
phpMyAdmin uses the blowfish secret for cookie authentication. The first way to remove this error is to manually generate a blow_fish secret using a web-based generator.
First, we create a config.inc.php
file by executing the below command.
sudo nano /usr/share/phpmyadmin/config.inc.php
The file will look something like the one below. Use the web generator to generate a 32-character blow_fish secret and paste it below in place of BLOWFISH_SECRET
.
<?php // use here a value of your choice 32 chars long $cfg['blowfish_secret'] = 'BLOWFISH_SECRET'; $i=0; $i++; $cfg['Servers'][$i]['auth_type'] = 'cookie';
After pasting your new blow_fish secret, press Ctrl+X then type Y and hit Enter to save and exit. Run phpMyAdmin
again to see if the error is gone or not.
OR
Open the vendor_config.php
file in nano
using the below command.
sudo nano /usr/share/phpmyadmin/libraries/vendor_config.php
Now press Ctrl+W and search for CONFIG_DIR
.
Change this line to the following.
define('CONFIG_DIR', '/etc/phpmyadmin/');
Press Ctrl+X, then type Y and press Enter to save and exit.
The “blow_fish secret too short” Error
You might also see an error message like The secret passphrase in configuration (blowfish_secret) is too short.
We are going to open the /var/lib/phpmyadmin/blowfish_secret.inc.php
file in the nano editor and edit the blow_fist secret.
sudo nano /var/lib/phpmyadmin/blowfish_secret.inc.php
Generate a blow_fish secret using any web-based generator of your choice and paste it after the $cfg['blowfish_secret'] =
phrase in the file, as shown below.
$cfg['blowfish_secret'] = 'HcZREI_paKbuhigNl40*YekxyYSju$0f';
Press Ctrl+X, then type Y and hit Enter to save and exit. Log out and log back into phpMyAdmin to see if the error is gone.
Conclusion
In this tutorial, we learned how you can get the latest version of phpMyAdmin by first downloading the respective .tar.gz
file from the official website and then extracting this file into the proper directory.
We also took a look at some of the common errors users face after installing phpMyAdmin and how you can resolve these errors.