How to Upgrade phpMyAdmin manually?

I am using PHP7.2 for one of my projects and facing compatibility issues while working in phpMyAdmin 4.6. I do some Google and find out a solution. So in this article, we will go through the process of how to upgrade phpMyAdmin 4.6 to 4.9 to solve the issue.

The issue/warning we are facing:

Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable

Why we get this warning: Please check this link for details – https://wiki.php.net/rfc/counting_non_countables

 

Let’s start…

Step 1: Backup existing phpMyAdmin

1.1 First thing Fast, Save your Ass. Back up our existing phpMyAdmin folder by renaming it.

sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin_bakup

1.2 Create a new phpMyAdmin folder

sudo mkdir /usr/share/phpmyadmin/

1.3 Change the directory to

cd /usr/share/phpmyadmin

 

Step 2: Download the latest version phpMyAdmin and extract it.

2.1 Go to the phpMyAdmin download page and find out the latest stable version. In my case I am using “phpMyAdmin-4.9.1-all-languages.zip”

2.2 If you already have wget package installed in the OS then skip it, otherwise install wget

sudo apt-get update

sudo apt-get install wget

2.3 Now download the latest stable version of phpMyAdmin and make sure to change the command below. And let me know in the comment that I can update this article for others.

sudo wget https://files.phpmyadmin.net/phpMyAdmin/4.9.1/phpMyAdmin-4.9.1-all-languages.zip

2.4 If you don’t have unzip package installed then install the unzip by otherwise skip this step

sudo apt-get install unzip

2.5 Now extract.

sudo upzip phpMyAdmin-4.9.1-all-languages.zip

Once extracted list folder

ls

You should see a new folder phpMyAdmin-4.9.1-all-languages

2.6 Now we are going to move the content of this folder to /usr/share/phpmyadmin

sudo mv phpMyAdmin-4.9.1-all-languages/* /usr/share/phpmyadmin

Now you can log back into phpMyAdmin on your browser and check the current version. You may also notice two errors at the bottom of the page

The configuration file now needs a secret passphrase (blowfish_secret)

The $cfg[TempDir] (./tmp/) is not accessible. phpMyAdmin is not able to cache templates will be slow because of this

So, let’s fix these error too in the next steps

 

Step 3: To fix these two errors we need to update vendor_config.php file

3.1 Open vendor_config.php file

sudo nano /usr/share/phpmyadmin/libraries/vendor_config.php

3.2 Press Ctrl+w to search TEMP_DIR

Change line to

define(‘TEMP_DIR’, ‘/var/lib/phpmyadmin/tmp/’);

3.3 Again press Ctrl+w and search CONFIG_DIR

Change line to

define(‘CONFIG_DIR’, ‘/etc/phpmyadmin/’);

3.4 phpMyAdmin now generates its own blowfish secret based on the install directory

Save the file and exit by pressing Ctrl+x, press y and then press enter.

 

Step 4: Cleaning-up

4.1 I hope now everything is ok. Now you can delete the downloaded .zip file and empty the directory

sudo rm /usr/share/phpmyadmin/phpMyAdmin-4.9.1-all-languages.zip

sudo rm -rf /usr/share/phpmyadmin/phpMyAdmin-4.9.1-all-languages

4.2 Now make sure your new upgraded phpMyAdmin is working fine, then you can also delete the backup directory

sudo rm -rf /usr/share/phpmyadmin_bakup

If you like this article then please share and let others know about this. Thanks.

 

 

Ref. – stackoverflow.com, devanswers.co, phpmyadmin.net, wiki.php.net

Inspire Me :)

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.