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 (269 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.

375 replies

avatar
  Subscribe  
newest oldest
Notify of
Bob Hope
Guest
Bob Hope
Bob Hope
11 days 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
14 days 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
16 days ago

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

Giovanni Correa
Guest
Giovanni Correa
Giovanni Correa
24 days 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
1 month 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
1 month ago

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

JPA
Guest
JPA
JPA
1 month ago

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

fomm
Guest
fomm
fomm
1 month 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
1 month 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
1 month ago

thank you!

simo
Guest
simo
simo
1 month ago

thanks a lot, it works

vbauss
Guest
vbauss
vbauss
1 month ago

Thank you so much !!

Abhay
Guest
Abhay
Abhay
1 month ago

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

MoBO
Guest
MoBO
MoBO
1 month 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
1 month ago

Perfect Tutorial!

Upgraded in a couple of minutes.

Thanks!

Luiz Vidaum
Guest
Luiz Vidaum
Luiz Vidaum
1 month 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
1 month ago

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

Dan
Guest
Dan
Dan
1 month ago

Fantastic. Thanks you very nuch

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

Génial…bravo et merci…
Djimel

Espen
Guest
Espen
Espen
2 months ago

Fantastic!

DevStay
Guest
DevStay
DevStay
2 months ago

Very good! Thanks man…

DevStay
Guest
DevStay
DevStay
2 months ago

Great!! Thank you…

Vassilis
Guest
Vassilis
Vassilis
2 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
2 months ago

thank you so much!

Tony Metogo
Guest
Tony Metogo
Tony Metogo
2 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
2 months ago

Thanks you very mush!

nedvajz
Guest
nedvajz
nedvajz
2 months ago

thanks!

Jordi Belloc
Guest
Jordi Belloc
Jordi Belloc
2 months ago

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

wissper
Guest
wissper
wissper
2 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
2 months ago

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

SafetyFast
Guest
SafetyFast
SafetyFast
2 months ago

Perfect! Thanks for sharing this!

zukamzukaTZ
Guest
zukamzukaTZ
zukamzukaTZ
2 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
2 months ago

Thank you! This saved me a lot of grief

Giuseppe
Guest
Giuseppe
Giuseppe
2 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
2 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
2 months ago

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

Appreciated.

Leon
Guest
Leon
Leon
2 months ago

Thanks a lot for your support!.

Regards!

Bogdan Gheorghe
Guest
Bogdan Gheorghe
Bogdan Gheorghe
2 months ago

Small correction is about caps.

On CentOS, phpmyadmin = phpMyAdmin on all folders.

sudo mkdir /var/lib/phpMyAdmin/tmp/
sudo chown -R apache:apache /var/lib/phpMyAdmin/tmp
sudo chmod -R 0755 /var/lib/phpMyAdmin/tmp/

All working great

ahmed
Guest
ahmed
ahmed
2 months ago

Thank you so much

alebal
Guest
alebal
alebal
3 months ago

Hi, I update to phpmyadmin-5.0.1 in centos 8, but the 2 errors doesn’t disappear… this dir /etc/phpmyadmin/ don’t exist and my server can’t create it..

cd /var/lib/phpmyadmin/tmp/

-bash: cd: /var/lib/phpmyadmin/tmp/: No such file or directory

sudo mkdir /var/lib/phpmyadmin/tmp/

mkdir: cannot create directory ‘/var/lib/phpmyadmin/tmp/’: No such file or directory

what can I do?

nntp
Guest
nntp
nntp
3 months ago

Very Well!!!

Felipe
Guest
Felipe
Felipe
3 months ago

Thanks, it worked, eh fixed the error

AmooAti
Guest
AmooAti
AmooAti
4 months ago

Thank You

Cocest
Guest
Cocest
Cocest
4 months ago

You have saved me countless hours. Thank you.

ehjohnyk
Guest
ehjohnyk
ehjohnyk
4 months ago

Thank you 🙂

Stefan
Guest
Stefan
Stefan
4 months ago

Thank you DevAnswers.co!

Milad
Guest
Milad
Milad
4 months ago

Honestly, The Best Tutorial about Ubuntu I’ve seen before , Specially for beginners . Thanks for this beginner friendly How To .

Juan
Guest
Juan
Juan
4 months ago

muchas gracias por el aporte