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.5

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.2, released March 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.5 instead.

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

Now extract

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

Once extracted, list folder

ls

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

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

sudo mv phpMyAdmin-5.0.2-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.5 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.2-all-languages.tar.gz
sudo rm -rf /usr/share/phpmyadmin/phpMyAdmin-5.0.2-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.99 (280 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.

388 replies

avatar
  Subscribe  
newest oldest
Notify of
Alidamir
Guest
Alidamir
Alidamir
5 days ago

very good

Ardiansah Ardiansah
Guest
Ardiansah Ardiansah
Ardiansah Ardiansah
15 days ago

nice job bro

MikeT
Guest
MikeT
MikeT
19 days 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
22 days 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
29 days ago

Perfect Article! Thank you mate 🙂

Guillermo Hurtado A
Guest
Guillermo Hurtado A
Guillermo Hurtado A
1 month ago

Thank you! Perfecto!

Lukasw
Guest
Lukasw
Lukasw
1 month ago

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

secondflowmedia
Guest
secondflowmedia
secondflowmedia
1 month ago

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

huseini
Guest
huseini
huseini
1 month ago

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

misbah
Guest
misbah
misbah
1 month ago

Good tutorial

TED
Guest
TED
TED
1 month 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
2 months ago

Great post!
Thank you so much!

Bob Hope
Guest
Bob Hope
Bob Hope
3 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
3 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
3 months ago

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

Giovanni Correa
Guest
Giovanni Correa
Giovanni Correa
3 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
3 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
3 months ago

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

JPA
Guest
JPA
JPA
3 months ago

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

fomm
Guest
fomm
fomm
3 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
3 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
3 months ago

thank you!

simo
Guest
simo
simo
3 months ago

thanks a lot, it works

vbauss
Guest
vbauss
vbauss
3 months ago

Thank you so much !!

Abhay
Guest
Abhay
Abhay
4 months ago

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

MoBO
Guest
MoBO
MoBO
4 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
4 months ago

Perfect Tutorial!

Upgraded in a couple of minutes.

Thanks!

Luiz Vidaum
Guest
Luiz Vidaum
Luiz Vidaum
4 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
4 months ago

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

Dan
Guest
Dan
Dan
4 months ago

Fantastic. Thanks you very nuch

Igor
Guest
Igor
Igor
4 months ago

Uhll! I think I’m close! 90% of my bugs disappeard. The only issue (new one) is “Failed to read configuration file!”

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

I was trying to find a solution before reaching you. The problem is that there is a message “This usually means there is a syntax error in it, please check any errors shown below.”, but the field bellow is empty. Any idea what could be? Thx in advance.

Duco
Guest
Duco
Duco
4 months ago

Hi, after doing everything you told me to do, I still got the exact same two errors… can you help me?

djimel
Guest
djimel
djimel
4 months ago

Génial…bravo et merci…
Djimel

Espen
Guest
Espen
Espen
4 months ago

Fantastic!

DevStay
Guest
DevStay
DevStay
4 months ago

Very good! Thanks man…

DevStay
Guest
DevStay
DevStay
4 months ago

Great!! Thank you…

Vassilis
Guest
Vassilis
Vassilis
4 months ago

Hi sorry for this, everything works and I can clearly see the latest 5.0.2 version, but I have the issue that if I run “apt update” it tells me that my installed version is 4.6.6 and fails to upgrade to the proposed 4.9.5. Is there a way to fix my apt in a way that it will understand that my version is now 5.0.2? many thanks

vassilis
Guest
vassilis
vassilis
4 months ago

thank you so much!

Tony Metogo
Guest
Tony Metogo
Tony Metogo
4 months ago

hello i have this error which is displayed at the bottom of my page how to fix it please
$cfg[‘TempDir’] (/var/lib/phpmyadmin/temp/) is not accessible. phpMyAdmin is unable to cache models and therefore will be slow.

Bohdan
Guest
Bohdan
Bohdan
4 months ago

Thanks you very mush!

nedvajz
Guest
nedvajz
nedvajz
4 months ago

thanks!

Jordi Belloc
Guest
Jordi Belloc
Jordi Belloc
4 months ago

It worked like a charm! Many thanks. Great post and great site!

wissper
Guest
wissper
wissper
5 months ago

Superb – you anticipated all the hiccups I would find. I never had to look anywhere else for once! lol

Thanks mate.

henry
Guest
henry
henry
5 months ago

Hello… Many thanks for this, it help perfectly. Very good job.

SafetyFast
Guest
SafetyFast
SafetyFast
5 months ago

Perfect! Thanks for sharing this!

zukamzukaTZ
Guest
zukamzukaTZ
zukamzukaTZ
5 months ago

thanks alot, I was about to go back to selling drugs….. but then again it happens with every bump in the way

Mtuwanguvu
Guest
Mtuwanguvu
Mtuwanguvu
5 months ago

Thank you! This saved me a lot of grief

Giuseppe
Guest
Giuseppe
Giuseppe
5 months ago

I’ve installer Php FPM 7, 7.1 , 7.2, 7.3 but phpmyadmin still uses php5.6 so I can’t upgrad to v5.xx . How can I change the version of php that phpmyadmin uses? Thanks

Anthony Allen
Guest
Anthony Allen
Anthony Allen
5 months ago

Thank you sir!

If possible suggest to audience to wget to a different directory, maybe home but not /usr/share/phpmyadmin.

Well done. I appreciate this!

Digital Essence
Guest
Digital Essence
Digital Essence
5 months ago

Thank you. Sorted out my Raspberry Pi install. Nice easy to follow instructions.

Appreciated.