Manually upgrade phpMyAdmin

How to Manually Upgrade phpMyAdmin

Last updated on

Since the release of Ubuntu 18.04 and some other Linux distros, many people have been having compatibility issues with PHP 7.2 and phpMyAdmin 4.6. In this article we will manually download and install the latest version of phpMyAdmin to resolve these issues.

It’s possible that when you installed phpMyAdmin, your repository was still serving phpMyAdmin v4.6.6 and not the latest version (v4.8.3 as of writing), which is causing compatibility issues with PHP 7.2.

Firstly, visit the phpMyAdmin download page and look for the latest version. As of writing, the latest is phpMyAdmin 4.8.3, which we will install in this guide.

1. Backup phpMyAdmin

You should backup 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/

Change to directory

cd /usr/share/phpmyadmin/

2. Download and Extract phpMyAdmin

Visit the phpMyAdmin download page and look for the .tar.gz URL and download it using wget. In this guide, we are using version 4.8.3. If you are using a later version, make sure to change the commands below to match.

sudo wget https://files.phpmyadmin.net/phpMyAdmin/4.8.3/phpMyAdmin-4.8.3-all-languages.tar.gz

Now extract

sudo tar xzf phpMyAdmin-4.8.3-all-languages.tar.gz

Once extracted, list folder

ls

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

We want to move the contents of this folder to /usr/share/phpmyadmin

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

You can now log back into phpMyAdmin and check the current version. You may also see two errors:

phpMyadmin blowfish secret error and tempdir not writable error

3. Edit vendor_config.php

If you are seeing an error The $cfg[‘TempDir’] (./tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.

Open vendor_config.php

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

Press CTRL + W and search for TEMP_DIR

Change line  to

/usr/share/phpmyadmin/libraries/vendor_config.php
define('TEMP_DIR', '/var/lib/phpmyadmin/tmp/');

You may also see an error The configuration file now needs a secret passphrase (blowfish_secret). The blowfish secret is used by phpMyAdmin for cookie authentication. Blowfish secret

Press CTRL + W and search for CONFIG_DIR

Change line to

/usr/share/phpmyadmin/libraries/vendor_config.php
define('CONFIG_DIR', '/etc/phpmyadmin/');

phpMyAdmin will now generate its own blowfish secret based on the install directory.

Save file and exit. (Press CTRL + X, press Y and then press ENTER)

Now log back in to phpMyAdmin and ensure the errors are gone.

4. Cleanup

You can now delete the tar.gz file and the empty folder.

sudo rm /usr/share/phpmyadmin/phpMyAdmin-4.8.3-all-languages.tar.gz
sudo rm -rf /usr/share/phpmyadmin/phpMyAdmin-4.8.3-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

Hurrah!

Let me know in the comments if this helped. Follow me @DevAnswers or read more.

1 Star2 Stars3 Stars4 Stars5 Stars 5.00 (86 votes)

Feedback

Your email address will not be published. Required fields are marked *

We use Markdown to style comments, like on Github and Reddit.
To do a line break, type two spaces after the sentence.
You can add inline code by wrapping it in backticks: `code here`

    To do an entire block of code  
    type four spaces before the line
    and it will appear in a block like this.
    <-- four empty spaces

101 replies

Clear, concise & accurate instructions.
Great use of the command line and a ‘workflow’ process.
And it worked 🙂

I did reinstall mysql and phpmyadmin multiple times in my raspberry pi ubuntu 18.04 server. phpmyadmin still had issues, but this manual totally helped. Many thanks

Thank you!!! Hero level. Direct, to the point, and top of search results. BRAVO.

After a few months of aggravating error messages you solved the problem! This worked just as you said and is wonderful!!!!!! Can’t thank you enough.

hello,
please help, i have mysql 8, php 7.2.7
i installed phpmyadmin 4.6.6 and i had this errors, so i upgraded to 4.8.3 like you did but the errors still exists.
please help

The phpMyAd*min configuration storage is not completely configured,
some extended features have been deactivated. Find out why. Or
alternately go to ‘Operations’ tab of any database to set it up
there. Open new phpMyAdmin window.
mysqli_real_connect(): (HY000/1045): Access denied for user
‘phpmyadmin’@’localhost’ (using password: YES).
Connection for controluser as defined in your configuration failed.*

Thanks, excellent. Just a problem : the automatically generated blowfish secret phrase was too short : 24 chars, yet 32 needed. Modified in var/lib/phpmyadmin/blowfish_secret.inc.php (Raspbian)

I have read tens of guides for Linux and no one was so simple and useful. I’d want to all guides was like this. Thank you.
(sorry for my English, i’m not a native speaker)

Thank you, i really appreciate your tutorial. The errors have been bugging me for a while, now all is fixed. Best regards and keep up the good work.

Within the created DIR "/usr/share/phpmyadmin" is a file calles “config.sample.inc.php”.
Open it, add a 32char alphanumeric string as value of “cfg[blowfish_secret]” and safe it as “config.inc.php”.

While in the editing of

"/usr/share/phpmyadmin/libraries/vendor_config.php"

DO NOT replace

"define('CONFIG_DIR', '');" by "define('CONFIG_DIR', '/etc/phpmyadmin/');".

Instead take the path to the just altered “config.inc.php”. Take care, (maybe) because of the updating-process, there are minimum 2 other “config.inc.php” on your system under
1) “/var/lib/phpmyadmin” (is empty)
2) “/etc/phpmyadmin/” which will load the “blowfish”-file from “/var/lib/phpmyadmin”.

In my case it was just possible to satisfy the error-message when pointing to “/usr/share/phpmyadmin/config.inc.php” with filled “blowfish_secret” as “CONFIG_DIR”.

Finally, thank you very much for this guide.

Why not just set define('CONFIG_DIR', '/etc/phpmyadmin/'); ?

This gets rid of the blowfish error.

Hello,

It was working till yesterday, Now i cant find config.inc.php and setting up blowfish_secret in this blog

There is an easier method to get rid of that error. Open /usr/share/phpmyadmin/libraries/vendor_config.php, search for CONFIG_DIR and change it to:

define('CONFIG_DIR', '/etc/phpmyadmin/');

A quicker fix for the blowfish_secret :

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

Press CTRL + W and search for CONFIG_DIR

Change line to:
define(‘CONFIG_DIR’, ‘/etc/phpmyadmin/’);

Wonderful straight forward, easy to follow write up. Very well done. And most importantly, thank you for posting this tip to fix this issue for Ubuntu 18.04 users! (Not that it matters as it’s the same Ubuntu as in pure Linux, but implemented this fix in Windows Subsystem for Linux – Ubuntu 18.04)

sir im new to this why is it after following this steps my localhost/phpmyadmin/ is blank page now?

All I can recommend is that you restore your backup.

sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin.del

sudo mv /usr/share/phpmyadmin.bak/ /usr/share/phpmyadmin

Check that phpMyAdmin is working again.

Thank you very much for this accurate tutorial. Everything works fine.
Have a nice day.

Yo realice todos los pasos pero me dejo un warning que dice
El archivo de configuración ahora necesita una frase secreta (blowfish_secret).

Buscando como arreglaro, edite el archivo config.default.php y en la linea $cfg[‘blowfish_secret’]=’ColocarValorAleatorio’

QUEDANDO DE ESTA FORMA
$cfg[‘blowfish_secret’] = ‘a0sfo49nadf89fa3s8f789sf78asb7p1587balz’

segun esto se tiene que colocar un valor aleatorio, no se si sea correcto esto, sin embargo a mi me funciono.

NOTA: para buscar la ubicacion del archivo
sudo find / -name config.default.php