22

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 personal archive which offers the following commands.

sudo add-apt-repository ppa:nijel/phpmyadmin
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 update phpmyadmin

This did successfully get past the version 4.5.4 limit, but, only updated to version 4.6.6 which was released January 23 2017.

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?

  • 2
    @Rinzwind, It's currently at version 4.5.4 and I'd like it to be the current version of 4.7.3, how is that not and upgrade? – Dwight Wilbanks Aug 21 '17 at 6:52
27

@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/.

  • Nice gidelines! I've followed them with few side steps: a) instead of removing the old version, I'd rename it; b) it may be handy to create symbolic link phpmyadmin, which can be easily switched between multiple versions. – AntonK Nov 6 '18 at 22:56
  • I have copied your answer here as I think is the best option. If you want to make your own answer, tell me and I'll remove mine. – PhoneixS Dec 10 '18 at 12:35
  • It's fine. Big thanks for the credit and having the decency to inform me! @PhoneixS – CRIMSON 501 Dec 10 '18 at 21:06
  • You should also remove the downloaded ZIP file as part of the clean up – IvanRF Jan 3 at 0:02
10

I just had to do this because of issues with php7.2 and receiving the error count(): Parameter must be an array or an object that implements Countable.

The version from apt was 4.5.4 and the ppa does not have the fixes for php7.2. My solution was to download the latest version from https://www.phpmyadmin.net/ and copy the files to /usr/share/phpmyadmin.

  • 1
    worked for me like a charm – Norman Bird Feb 18 '18 at 0:27
  • OK, much better now! Debian (and Ubuntu) should upgrade their packages. Ps. I'm even running PHP 7.3. – danger89 Dec 27 '18 at 3:29
3

As stated above, you need to update the files manually but I searched for an hour to find out where these were located (/usr/share) and kept seeing that it was going to be placed into /var/www/html which is incorrect. If you installed the software with apt-get install phpmyadmin after adding the repository above which claims to be current, then you at least get the php7.2 libs needed. Then you need to install the NEW version (4.8) into /usr/share/phpmyadmin by going to the /usr/share and cloning the git: git clone https://github.com/phpmyadmin/phpmyadmin.git (I did rm -rf phpmyadmin first) just to be sure no old code was left. Then when going into the web interface....you see the newest version is now being used. Then be sure to cd to phpmyadmin and run : composer update --no-dev This gets the added libraries needed. This installs 4.9.0-dev which runs great and I am running Ubuntu 16.04.4. Thanks hope this helps someone save time

  • Thank you!, this saved my day! but I decided to use the stable one github.com/blackmambano5/phpmyadmin.git this is version 4.8.1 and everything works! – gfivehost Jun 11 '18 at 15:12
  • Thanks, this helped. I installed from zip, not from Github, not much difference there. I suggest editing the question to break the large paragraph into a list of steps. – pgr Jul 6 '18 at 10:20
2

I would use the personal archive for phpmyadmin if you really need the latest version. Mind though that there is a dependency (you need a newer php too):

PPA description

Latest phpMyAdmin packages - https://www.phpmyadmin.net/. Based on packages available in Debian.

There are some notable changes:

  • 2
    I think he asked how to update it to latest version, not where the install can be downloaded. – Tarik Jan 6 '18 at 18:37
  • 1
    In July 2018, that PPA is still at 4.6.6 (with the bug) while phpMyAdmin is at 4.8 (without the bug). Looks like the PPA is no longer maintained? – Steve Jul 2 '18 at 0:07
2

You can simply manually install the latest version of phpmyadmin.

Head over to https://www.phpmyadmin.net/downloads and download the latest version but make sure you have the compatible PHP and MySQL version as listed on the website.

Extract it to your server public folder and edit the config.inc.php file. Make sure your auth_type is cookie and host is whatever your host is. This setting will make you enter your username and password when logging in.

/*Authentication type*/
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['host'] = 'localhost';
0

I would advise to use Docker to run the latest phpmyadmin. It's simple to set up and all dependencies are automatically managed and don't interact with your local install. It uses 25MB of RAM so it's also not a memoryhog.

Very easy to run the latest phphmyadmin on whichever platform.

https://docs.phpmyadmin.net/en/latest/setup.html#installing-using-docker

0

Crimson501's answer is perfect unless your on Ubuntu, in order to fix the blowfish and tmp file issue on ubuntu you need to modify the following file, to reference the existing config, and tmp directory that ubuntu uses.

Using your favorite text file editor modify:

/usr/share/phpmyadmin/libraries/vendor_config.php
find TEMP_DIR
modify './tmp/' to '/var/lib/phpmyadmin/tmp/'
find CONFIG_DIR
modify '' to '/etc/phpmyadmin/'
save the changes

Now when you go back and refresh the page the errors will be gone.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.