How to upgrade phpMyAdmin on Linux?

Introduction

The following has been tested on a Cloud9 server with the following versions:

There is a bug in this version, and when ones trying to export, the following error appears :

Fatal error: Cannot 'break' 2 levels in /usr/share/phpmyadmin/export.php on line 864

In newer versions of phpMyAdmin, the problem is solved, but I don't have enought space on my server to upgrade Ubuntu thanks to apt-get upgrade. So I explain on this page how to upgrade only phpMyAdmin.

Upgrade phpMyAdmin

First, change diretory for /usr/share/ and backup previous version of phpMyAdmin (just in case ...):

cd /usr/share/
sudo mv phpmyadmin/ phpmyadmin-4.0.10/

Download and extract the last version of phpMyAdmin. I my case, I uploaded version 4.7.7 which is not the newest, but is the version installed on my production server:

sudo wget https://files.phpmyadmin.net/phpMyAdmin/4.7.7/phpMyAdmin-4.7.7-all-languages.zip
sudo unzip phpMyAdmin-4.7.7-all-languages.zip

Set the downloaded version as current version:

# Symbolic link:
sudo ln -s phpMyAdmin-4.7.7-all-languages phpmyadmin           
# OR folder copy:
sudo mv phpMyAdmin-4.7.7-all-languages phpmyadmin

Now set the proper permissions on files (not sure this mandatory for an upgrade), from How to Install and Secure PhpMyAdmin on Linux using Source Archive:

### Debian based system 
sudo chown -R www-data:www-data /usr/share/phpmyadmin
sudo chmod -R 755 /usr/share/phpmyadmin

### Redhat based system 
sudo chown -R apache:apache /usr/share/phpmyadmin
sudo chmod -R 755 /usr/share/phpmyadmin

Restart Apache, your new version is installed.

sudo service apache2 restart

See also


Last update : 11/08/2018