Manually upgrade phpMyAdmin

How to Manually Upgrade phpMyAdmin

Last updated on

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

Introduction

This guide has been tested on Ubuntu 20.04, 18.04 and 16.04. It should also work for other Debian-based distributions without issue. For CentOS users, please refer to the comments section at the end of this page as commands will be different. I will try to update this guide for CentOS as soon as I get the chance to test it. In the meantime, if you have any suggestions on how to improve this guide, please let me know in the comments.

1. Back up phpMyAdmin

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

Change to directory

cd /usr/share/phpmyadmin/

2. Download and Extract phpMyAdmin

Update Feb 2020: phpMyAdmin 5 has been released but it is only compatible with PHP 7.1 and above. To find out your PHP version in command line, run php -v.

phpMyAdmin version 4.x is now in the LTS phase, where only security fixes and critical bug fixes are made. Users are advised to migrate to version 5 (read more).

  • For PHP 7.1 and above, download phpMyAdmin 5.x
  • For PHP 5.5 to PHP 7.4, download phpMyAdmin-4.9.7

Visit the phpMyAdmin download page and look for the .tar.gz URL and download it using wget. In this guide we are using version 5.0.4, released October 2020. If a later version is now available, make sure to change the commands below to match (and let me know in the comments so I can update the guide 😉). If you are having issues with phpMyAdmin 5.x, try phpMyAdmin-4.9.7 instead.

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

Now extract

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

Once extracted, list folder

ls

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

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

sudo mv phpMyAdmin-5.0.4-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.

If you are seeing an error “The secret passphrase in configuration (blowfish_secret) is too short.”, see below.

If you are having issues with phpMyAdmin 5, try phpMyAdmin-4.9.7 instead as this is the latest stable release for PHP 7.0 and lower and MySQL 5.4 and lower.

4. Cleanup

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

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

Blowfish Secret Error “Too Short”

If you are seeing an error “The secret passphrase in configuration (blowfish_secret) is too short.”

Open blowfish_secret.inc.php:

sudo nano /var/lib/phpmyadmin/blowfish_secret.inc.php

Click here to generate a 32-character random phrase.

Copy it and paste it into blowfish_secret.inc.php.

/var/lib/phpmyadmin/blowfish_secret.inc.php
<?php
$cfg['blowfish_secret'] = '32_char_random_phrase_here';

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

1 Star2 Stars3 Stars4 Stars5 Stars 4.97 (290 votes)

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

p.s. I increased my AdSense revenue by 68% using AI 🤖. Read my Ezoic review to find out how.

415 replies

avatar
  Subscribe  
newest oldest
Notify of
Wong
Guest
Wong
Wong
2 days ago

This is the best tutorial ever I’ve followed online.

Erik
Guest
Erik
Erik
4 days ago

Thanks for the clear explaination..

Some Kudo’s for you!

Nikhil Gyan
Guest
Nikhil Gyan
Nikhil Gyan
6 days ago

Thanks a lot. This is great and life-saving for me.

kajdzo
Guest
kajdzo
kajdzo
7 days ago

Great walkthrough, thanks!

Robert
Guest
Robert
Robert
8 days ago

Thank you

Alex
Guest
Alex
Alex
9 days ago

This is just brilliant!
Thank you soo much.

Andrew
Guest
Andrew
Andrew
10 days ago

Awesome! Case does matter though in centos it’s /usr/share/phpMyAdmin/

Robert
Guest
Robert
Robert
12 days ago

Worked all great! Thanks.

Jim
Guest
Jim
Jim
13 days ago

Thanks. Worked perfectly once I found MY typo!

Jim
Guest
Jim
Jim
13 days ago

Followed all steps and now phpmydamin just opens to a blank page. Rebooting made no difference.

Jim
Guest
Jim
Jim
13 days ago

Resolved – it was a typo

D K
Guest
D K
D K
17 days ago

Awesome tutorial!

Mohammad
Guest
Mohammad
Mohammad
25 days ago

Thank you so much!

Dimitris
Guest
Dimitris
Dimitris
1 month ago
thank you very much
Mike Echo
Guest
Mike Echo
Mike Echo
1 month ago

I had some trouble, but after copying the old “config.inc.php” over, everything runs perfect.

Earl
Guest
Earl
Earl
1 month ago

Great Tutorial ! I don’t know what exactly happened but after closely following the instructions to install phpmyadmin I get the infamous 4O4 ERROR – URL not found on this server. Every other thing worked as per the instructions.

Asif Nadaf
Guest
Asif Nadaf
Asif Nadaf
1 month ago

Thanks for the awesome tutorial

Simon
Guest
Simon
Simon
1 month ago

New Version of phpMyAdmin 🙂
Thanks for this complete tutorial ^^

Hamdi Bey
Guest
Hamdi Bey
Hamdi Bey
1 month ago

Great article. Very professionnal. Thanks.

RenzoTello
Guest
RenzoTello
RenzoTello
1 month ago

Hello, I have a question, I really don’t know if you can help me, but if you do, I would appreciate it too much! The problem is the following: I have a VPS, in it I put the Phpmyadmin, mysql, etc …, I also installed the OGP (Open Game Panel), the fact is that when I create the database of one of my server games, everything is fine, it connects well and everything, but when I enter the game and try to register, it does not let me, I get that the account “supposedly already exists”, but in reality it does not exist, a table must be created in the table ” users ” with the user’s data, but it is not like that, I get that error, if you could help me I would appreciate it, I know it does not have much to do with what you published, but I am new to this and I do not know how to fix it .

Postscript: It is not the game, since the game is called “SAMP” (San Andreas MultiPlayer) and actually in other VPS if it works well, but not in mine, then the problem must be with MySQL or PhpMyAdmin, but I really don’t know.

edwar vilchez
Guest
edwar vilchez
edwar vilchez
1 month ago

Thank you you saved my installation and my life.

Roger
Guest
Roger
Roger
2 months ago

Great tutorial – Thank you !

Alidamir
Guest
Alidamir
Alidamir
2 months ago

very good

Ardiansah Ardiansah
Guest
Ardiansah Ardiansah
Ardiansah Ardiansah
2 months ago

nice job bro

MikeT
Guest
MikeT
MikeT
3 months ago

One problem with 5.0.2 was I had no tmp directory under /var/lib/phpMyAdmin (it is phpMyAdmin not phpmyadmin). Created the tmp directory, changed ownership as apache:apache, made sure it had write permissions. Had to restart httpd for these config changes. Then errors went away.
When I set tmp pointer, site stopped working (did not exist – I did not confirm first).
Centos7
5.5.65-MariaDB – MariaDB Serve
Apache/2.4.6 (CentOS) PHP/7.3.22
phpMyAdmin: 5.0.2

Thomas
Guest
Thomas
Thomas
3 months ago

Great. I hate it when they keep updating shit so fast, and compatibility errors start occurring, but I love it when guys like you give us an simple fix.

Ingo
Guest
Ingo
Ingo
3 months ago

Perfect Article! Thank you mate 🙂

Guillermo Hurtado A
Guest
Guillermo Hurtado A
Guillermo Hurtado A
3 months ago

Thank you! Perfecto!

Lukasw
Guest
Lukasw
Lukasw
3 months ago

Perfection, the smoothest process I have ever experienced. Well done on this tutorial.

secondflowmedia
Guest
secondflowmedia
secondflowmedia
3 months ago

Thank you so much for this AWESOME tutorial! Every step was worked perfectly.

huseini
Guest
huseini
huseini
4 months ago

wow, just fantastic steps, every step was described, even how to save and exit editor in linus, Thank you

misbah
Guest
misbah
misbah
4 months ago

Good tutorial

TED
Guest
TED
TED
4 months ago

This is one of the best support pages I have experienced in my entire coding life span. I am 80 years old, I started learning how to code 5 years ago and in my humble opinion it is not easy, however it becomes easier to understand each day I continue to learn. This particular page was extremely helpful with your detailed and specific instructions/guidelines. They (instructions/guidelines) were easy to understand and follow, I did not have to go to another page to get explanations for anything. THANKS, I really like your style.
T.R.E.B.

duonghc
Guest
duonghc
duonghc
4 months ago

Great post!
Thank you so much!

Bob Hope
Guest
Bob Hope
Bob Hope
5 months ago

Unfortunately your tutorial seems to have made things worse, with an error coming up:

Error during session start; please check your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser.

session_write_close(): write failed: No space left on device (28)

session_write_close(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/sessions)

If anyone has any answers, then would be much appreciated!

Arafat
Guest
Arafat
Arafat
5 months ago

i always look at digitalocean for good tutorial for this kind of job. now i found another one.

truly thanks

Leandro
Guest
Leandro
Leandro
5 months ago

Thanks!!!
Works on Ubuntu 18.04 php7.2 and phpmyadmin 5.0.2

Giovanni Correa
Guest
Giovanni Correa
Giovanni Correa
5 months ago

Muchas Gracias el phpmyadmin me tenia sufriendo y no sabia porque era pero gracias a tu
pagina lo pude soluciona un saludo esta muy completa la explicacion.

Victor Diaz
Guest
Victor Diaz
Victor Diaz
6 months ago

Hola realice los camnios y todo funciono perfecto, pero Edite vendor_config.php y dejo de funcionar y ya no puedo hacer inicio en phpmyadmin.

Que puedo hacer para corregir.

gracias

Rajeev
Guest
Rajeev
Rajeev
6 months ago

Thanks. Works on Ubuntu 18.04 php7.2 and phpmyadmin 5.0.2

JPA
Guest
JPA
JPA
6 months ago

Thank you so much. It works like a charm!!!

fomm
Guest
fomm
fomm
6 months ago

Thank you very much.

This tutorial is very helpful with all the details and commands we need to fix the problem.

Shanu Kumar
Guest
Shanu Kumar
Shanu Kumar
6 months ago

Hello .. I am Using Google Cloud..I Just Updated Php Version to 7.3 and followed your process but after doing that when i try to log in phpmyadmin it says..PHP 7.1.3+ is required.
Currently installed version is: 7.0.33-0+deb9u7….But When i check through SSH It says 7.3 ..Please Help what to do..

no name
Guest
no name
no name
6 months ago

thank you!

simo
Guest
simo
simo
6 months ago

thanks a lot, it works

vbauss
Guest
vbauss
vbauss
6 months ago

Thank you so much !!

Abhay
Guest
Abhay
Abhay
6 months ago

Wonder Full, hardly a 5 min job. Thanks A TON!

MoBO
Guest
MoBO
MoBO
6 months ago

This is perfect! But if you’re running NGINX or Apache2 and you assign these services to a user, you’ll need to change the ownership of /var/lib/phpmyadmin/tmp &amp;&amp; /var/lib/phpmyadmin/blowfish_secret.inc.php &amp;&amp; /var/lib/phpmyadmin/config.inc.php to your user.

Where user == Your User Name

sudo chown user.user /var/lib/phpmyadmin/tmp
sudo chown root.user /var/lib/phpmyadmin/blowfish_secret.inc.php
sudo chown root.user /var/lib/phpmyadmin/config.inc.php
Jack
Guest
Jack
Jack
6 months ago

Perfect Tutorial!

Upgraded in a couple of minutes.

Thanks!

Luiz Vidaum
Guest
Luiz Vidaum
Luiz Vidaum
6 months ago

A solução mais simples e rápida que encontrei até agora. Parabéns.

E, para quem se interessar e tiver o mesmo problema, utilizao Ubuntu 18.04 em WSL (Windows 10 Home), PHP 7.4, Apache2 e Mysql.

Muito obrigado e sucesso!
Receba um abraço deste brasileiro.
Luiz Vidaum
São Paulo/Brasil

hexacube
Guest
hexacube
hexacube
6 months ago

Perfect tutorial. I have upgraded in 2 minutes. No issues at all. I didnt get that blowfish warning too.