If you have a web application, chances are that you’d be using a database like MySQL or MariaDB.
PhpMyAdmin is probably the most popular tool used to manage MySQL databases. While it is easy to use, it can be a bit difficult to setup.
Here at Bobcares, we help web developers and website owners to setup and maintain web applications as part of our Support services.
Today we’ll go through the common issues we’ve seen while setting up phpMyAdmin in Amazon EC2, and how we fix them.
Why to use phpMyAdmin on Amazon EC2
Amazon Elastic Compute Cloud (Amazon EC2) provides easy and secure platform for hosting web applications. That’s why, it is one among the favorite solutions for web developers.
Web developers need to work with their program and the database server simultaneously. So, they need applications like phpMyAdmin that helps to edit and view website databases.
However, phpMyAdmin is not a built-in solution in Amazon EC2 instances. It is located in the Extra Packages which need manual installation and set up.
Steps to install phpMyAdmin on Amazon EC2
Now, let’s have a look on the exact steps to install phpMyAdmin.
There are two ways to install phpMyAdmin in Amazon EC2. Let’s us see the exact steps in each method.
1. Install via YUM
Fortunately, installation of phpMyAdmin via package managers like YUM is pretty easy.
As the first step, we connect to the Amazon EC2 instance. Then, we need to enable the extra packages repo (EPEL repo) and install phpMyAdmin. For this, we execute the following commands.
sudo yum update
sudo yum --enablerepo=epel install phpmyadmin
Finally, we edit the configuration file at /etc/httpd/conf.d/phpMyAdmin.conf to make it available via web browser.
2. Manual Install
Similarly, phpMyAdmin can be installed via manual method as well.
Before proceeding with the installation, we need to make sure that necessary modules like php-mbstring, php-fpm, etc. are available in the instance.
Then, we need to switch to the install directory. Here, we will install it in /var/www/html folder.
We download the source package for the latest phpMyAdmin release from https://www.phpmyadmin.net/downloads.
[ec2-user ~]$ cd /var/www/html
[ec2-user html]$ wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
After this, we extract the package to phpMyAdmin folder using the command.
[ec2-user html]$ mkdir phpMyAdmin && tar -xvzf phpMyAdmin-latest-all-languages.tar.gz -C phpMyAdmin --strip-components 1
Then, we need to create a user for phpmyadmin and give it permission over the phpMyAdmin folder.
As the last step, we need to set a secret passphrase called “blowfish_secret” in the phpMyAdmin config file. Also, we have to delete the installation file phpMyAdmin-latest-all-languages.tar.gz too.
Now, the phpMyAdmin installation will be available in the public IP address of your instance. It can be accessed from the link http://my.public.ip/phpMyAdmin
Common failure points.
Although, the installation is pretty straight-forward, often phpMyAdmin do not open up correctly.
We’ll now see the common problems and how our Support Engineers fix them.
1. phpMyAdmin shows blank page
Occasionally, the phpMyAdmin page show up an empty page in browser. This happens due to wrong configuration of a parameter called AllowOverride in the web server. This AllowOverride option controls the way to process rewrite rules in the website’s .htaccess files.
To fix this, our Support Engineers edit the file httpd.conf to allow overrides in the phpMyAdmin installation directory, /var/www/html.
For this, we execute the commands shown below.
vi /etc/httpd/conf/httpd.conf
Find <Directory "/var/www/html">
Replace AllowOverride none with AllowOverride all
Save changes
Restart Apache server
2. Can’t connect to phpMyAdmin
At times, even after the successful installation, while accessing phpMyAdmin in web browser, it fails. This normally happens due to server-side restrictions.
Here, our Support Engineers first ensure that web server is running correctly. Then we check the firewall rules and see that web service ports are allowed.
[Need help with installation of custom packages on your Amazon EC2 instances, our Security Specialists can do it for you.]
Conclusion
PhpMyAdmin helps web developers to edit and view databases via browser. But this has to be setup on Amazon EC2 instance. Today, we’ve seen the two ways to install phpMyAdmin along with common failure points and their fixes.
0 Comments