It recently came to light that many of you have been finding warning messages in phpMyAdmin after upgrading to PHP 7.2. Especially, those of you who followed my video last year on how to install Magento 2.3.
Well, in this tutorial I’ll be covering how to update your version of phpMyAdmin to the latest version that is fully compatible with PHP 7.2 – Therefore allowing you to say goodbye to those annoying warnings.
For whatever reason when you install phpMyAdmin using the traditional “apt-get” command, it only installs an older version. And this version happens to have some incompatibilities with the latest version of PHP 7.2. This was never an issue before, because it’s only very recently that Magento 2 has supported this version of PHP.
The default version of phpMyAdmin that get installed on my server is version 4.5. Indicated on the homepage of the application. When running this version of phpMyAdmin with PHP 7.2 you will likely see warning messages like this.
Because we can’t currently update phpMyAdmin via my usual method of “apt-get” , it means I’ll have to do it manually. After doing a little research into this method, I ended up streamlining the installation process down to just 11 very simple steps.
Before starting the first step, I should point out that I’m already logged into my web server as a superuser . Just to recap, a superuser is a user that is capable of running commands beginning with “sudo” .
It’s also worth noting, that I’m literally copying and pasting these commands directly from this article.
Remember to always backup your server before following any instructions.
Steps to update phpMyAdmin
Ok, in step 1 I want to navigate to the User/Share folder. This is where I will be running most of my command from. This is simply done by entering the following command:
In the second step, I want to create a backup of my original installation of phpMyAdmin. This is just for peace of mind. To do that, I’ll run a command that allow me to move a folder and rename it at the same time. In this case, I’ll be renaming the phpmyadmin folder to phpmyadminbk . I tend to put the letters “bk” at the end of any temporary backups folders. So, I’ll be doing this by running the following command:
sudo mv phpmyadmin phpmyadminbk
In the third step, it’s time to download the latest copy of phpMyAdmin from their website directly onto our server. The easiest way to do this is by using the “wget” command. At the time of this video, the latest version is 4.8.5. So, the command I’ll need to enter is:
sudo wget https://files.phpmyadmin.net/phpMyAdmin/4.8.5/phpMyAdmin-4.8.5-all-languages.zip
In step 4, I’ll want to unzip the zip file that I just downloaded from the phpMyAdmin website. To do this, I simply need to enter:
sudo unzip phpMyAdmin-4.8.5-all-languages.zip
Now that I’ve unzipped the folder that I downloaded, I’ll need to rename it to phpmyadmin. This folder will take the place of the original folder that I renamed back in step 2
sudo mv phpMyAdmin-4.8.5-all-languages phpmyadmin
Now that all of the files have been downloaded, unzipped and renamed, it’s time to correctly set the ownership of the files. To do that, I’ll be running the “chown” command to set the ownership from “root” to “www-data” . “www-data” is what Apache requires it to be in order to read and write the files successfully. So, I’ll need to enter the following:
sudo chown -R www-data:www-data /usr/share/phpmyadmin
Next, I need to setup the configuration file for phpMyAdmin to run correctly. Luckily, the download comes with a sample file that I can copy and rename appropriately. The file that I’ll need to change is in the phpmyadmin directory. And I’ll need to rename the copy so that it doesn’t include the word “sample” . To do that, I just enter:
sudo cp phpmyadmin/config.sample.inc.php phpmyadmin/config.inc.php
In step 8, I’ll need to edit the new file that I just created so that I can create a security key. Security keys are required to help with encryption. So, to open up the config file in the nano text editor I’ll just type:
sudo nano phpmyadmin/config.inc.php
At this point, I’m not in the nano text editor viewing the contents of the config file. Luckily, there is already a comment next to the line I need to edit with some instructions. So, all I need to do is type a random set of numbers and letters in the space provided. I’m literally going hit random keys until I have around 40-60 characters.
Add a random string of numbers and text like the example below:
Now that I’m going entering in a random set of numbers and characters to generate my security key, I just need to save and exit. To do that I just need to press “Ctrl+X” to exit, then press “Y” and Enter to save. This will take me back to the original screen that I was on before.
The final step is just a bit of housekeeping. The following command will delete the original file that I downloaded in Step 3 that I no longer need anymore
sudo rm phpMyAdmin-4.8.5-all-languages.zip
If I’ve followed all of steps correctly, then that should mean when I log into phpMyAdmin it will show the latest version of phpMyAdmin. This is indicated here… And when I go into my database and click on any tables, the warning messages have now disappeared.