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 (302 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 200% using AI 🤖. Read my Ezoic review to find out how.

431 replies

avatar
  Subscribe  
newest oldest
Notify of
Anton
Guest
Anton
Anton
17 days ago

Thank you very much for that tutorial!

Jim
Guest
Jim
Jim
20 days ago

This is the first How-To I have followed to the letter that worked the first time in a long time! Thank you for the effort.

Tony
Guest
Tony
Tony
20 days ago

Fantastic. Did the job perfectly.

Darrik
Guest
Darrik
Darrik
24 days ago

Fantastic instructions!

Peter Francis
Guest
Peter Francis
Peter Francis
1 month ago

Thanks very much – worked a treat on Raspberry Pi OS (Buster).

Matt Wilson
Guest
Matt Wilson
Matt Wilson
1 month ago

upgrade process worked great, been fighting this for a while, and you saved me! well done!

Carlos Castro
Guest
Carlos Castro
Carlos Castro
1 month ago

Muchas gracias por el turorial!!

JHONATAN J J NUSS
Guest
JHONATAN J J NUSS
JHONATAN J J NUSS
2 months ago

Funcionou perfeitamente

sergio Saad
Guest
sergio Saad
sergio Saad
2 months ago

just perfect
And really well detailed! Great Job

Mac Baret
Guest
Mac Baret
Mac Baret
2 months ago

Awesome.

Worked and works like a charm.

Efficient tutorial.

JUST AWESOME OMG THANKS. ahah, sorry.

Raphael
Guest
Raphael
Raphael
2 months ago

Thanks a lot!

ahmed
Guest
ahmed
ahmed
2 months ago
thank you so much
vpougatchev
Guest
vpougatchev
vpougatchev
2 months ago

That is a great tutorial. But in my case when trying to open phpMyAdmin, it gave me a Permission denier error. So I had to run chmod 777 /var/lib/php/session/ then it worked.

Chris
Guest
Chris
Chris
2 months ago

Very good. Thank you very much!

me_th
Guest
me_th
me_th
2 months ago

error
The $cfg[‘TempDir’] (/usr/share/phpmyadmin/tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.

Lars
Guest
Lars
Lars
2 months ago

Very nice guide! Thanks a lot!
Kudos and greetings from Germany!

Wong
Guest
Wong
Wong
2 months ago

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

Erik
Guest
Erik
Erik
2 months ago

Thanks for the clear explaination..

Some Kudo’s for you!

Nikhil Gyan
Guest
Nikhil Gyan
Nikhil Gyan
2 months ago

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

kajdzo
Guest
kajdzo
kajdzo
3 months ago

Great walkthrough, thanks!

Robert
Guest
Robert
Robert
3 months ago

Thank you

Alex
Guest
Alex
Alex
3 months ago

This is just brilliant!
Thank you soo much.

Andrew
Guest
Andrew
Andrew
3 months ago

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

Robert
Guest
Robert
Robert
3 months ago

Worked all great! Thanks.

Jim
Guest
Jim
Jim
3 months ago

Thanks. Worked perfectly once I found MY typo!

Jim
Guest
Jim
Jim
3 months ago

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

Jim
Guest
Jim
Jim
3 months ago

Resolved – it was a typo

D K
Guest
D K
D K
3 months ago

Awesome tutorial!

Mohammad
Guest
Mohammad
Mohammad
3 months ago

Thank you so much!

Dimitris
Guest
Dimitris
Dimitris
3 months ago
thank you very much
Mike Echo
Guest
Mike Echo
Mike Echo
3 months ago

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

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

Thanks for the awesome tutorial

Simon
Guest
Simon
Simon
4 months ago

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

Hamdi Bey
Guest
Hamdi Bey
Hamdi Bey
4 months ago

Great article. Very professionnal. Thanks.

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

Thank you you saved my installation and my life.

Roger
Guest
Roger
Roger
4 months ago

Great tutorial – Thank you !

Alidamir
Guest
Alidamir
Alidamir
5 months ago

very good

Ardiansah Ardiansah
Guest
Ardiansah Ardiansah
Ardiansah Ardiansah
5 months ago

nice job bro

MikeT
Guest
MikeT
MikeT
5 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
5 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
6 months ago

Perfect Article! Thank you mate 🙂

Guillermo Hurtado A
Guest
Guillermo Hurtado A
Guillermo Hurtado A
6 months ago

Thank you! Perfecto!

Lukasw
Guest
Lukasw
Lukasw
6 months ago

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

secondflowmedia
Guest
secondflowmedia
secondflowmedia
6 months ago

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

huseini
Guest
huseini
huseini
6 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
6 months ago

Good tutorial

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

Great post!
Thank you so much!

Bob Hope
Guest
Bob Hope
Bob Hope
8 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!