How to upgrade PHPmyAdmin [revisited]

This question was asked previously, How to upgrade PHPmyAdmin

The answer given was

sudo apt-get update
sudo apt-get install phpmyadmin

or

sudo apt-get update
sudo apt-get upgrade

The version of phpmyadmin included in apt-get is 4.5.4, which was released January 28 2016.

In a response to this question one answer was to use use the phpMyAdmin archive which offers the following commands.

sudo add-apt-repository ppa:phpmyadmin/ppa
sudo apt-get update

In my case that updated a lot of things, but, not specifically phpmyadmin, I needed the additional command

sudo apt-get install phpmyadmin

This did successfully get past the version 4.9.0.1 which was released in 2019.

As of this writing it does seem that manually downloading and copying using the vague instructions from docs.phpmyadmin.net is required.

Is there a more current repository for phpmyadmin than the PPA or is a manual install required?

Answer

@Photo Larry pretty much hit the nail on the head! I am going to give an answer based on his that will be easy to understand and follow.

  • Your first step is to install PMA (phpMyAdmin) from the official Ubuntu repo: apt-get install phpmyadmin.
  • Next, cd into usr/share directory: cd /usr/share.
  • Third, remove the phpmyadmin directory: rm -rf phpmyadmin.
  • Now we need to download the latest PMA version onto our system (Note that you need wget: apt-get install wget): wget -P /usr/share/ "https://files.phpmyadmin.net/phpMyAdmin/4.8.2/phpMyAdmin-4.8.2-english.zip"
    Let me explain the arguments of this command, -P defines the path and “the link.zip” is currently (7/17/18) the latest version of PMA. You can find those links HERE.
  • For this next step you need unzip (apt-get install unzip): unzip phpMyAdmin-4.8.2-english.zip. We just unzipped PMA, now we will move it to it’s final home.
  • Lets use the cp (copy) command to move our files! Note that we have to add the -r argument since this is a folder. cp -r phpMyAdmin-4.8.2-english phpmyadmin.
  • Now it’s time to clean up: rm -rf phpMyAdmin-4.8.2-english.

Keep Reading!

You might now notice two errors after you log into PMA.

the configuration file now needs a secret passphrase (blowfish_secret). phpmyadmin
The $cfg['TempDir'] (./tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.

However, these issues are relatively easy to fix. For the first issue all you have to do is grab your editor of choice and edit /usr/share/phpmyadmin/config.inc.php but there’s a problem, we removed it! That’s ok, all you have to do is: cd /usr/share/phpmyadmin & cp config.sample.inc.php config.inc.php.

Example phpMyAdmin Blowfish Secret Variable Entry:

/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = '{^QP+-(3mlHy+Gd~FE3mN{gIATs^1lX+T=KVYv{ubK*U0V'; 
/* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

Now save and close the file.

  • Now we will create a tmp directory for PMA: mkdir tmp & chown -R www-data:www-data /usr/share/phpmyadmin/tmp. The last command allows the Apache web server to own the tmp directory and edit it’s contents.

EDIT Dec 12, 2018

You don’t want someone to steal your cookies, now do you?

It has been brought to my attention that https://www.question-defense.com/tools/phpmyadmin-blowfish-secret-generator causes errors on older versions on PMA. However, the main reason I discourage you to use websites like this is because you have no idea whether they use a weak PRNG (Pseudo-Random Number Generator) (e.g. rand(), mt_rand(), and lcg_value()) or one of the “shuffling” functions (e.g. str_shuffle(), shuffle(), array_rand()). As such, I made my own tool for this purpose. It generates a cryptographically secure 32 character string you can use without concern for security or errors! PHP man page for function I use to generate the randomness http://php.net/manual/en/function.random-int.php. I replaced the old link with this one: https://www.motorsportdiesel.com/tools/blowfish-salt/pma/.

EDIT Sep 11, 2020

I have changed the blowfish generator link as the old one is no longer reachable.

Attribution
Source : Link , Question Author : Dwight Wilbanks , Answer Author : ALZlper

Leave a Comment