Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing phpMyAdmin onto Amazon EC2 instance

I've configured my EC2 instance as a LAMP, following Amazon's tutorial. That appears to be functioning correctly (I can see phpinfo() in a file I've uploaded OK).

I then tried to install phpMyAdmin by doing the following:

sudo yum --enablerepo=epel install phpmyadmin

I can see that phpMyAdmin is now in /usr/share/phpmyadmin, so I added an symbolic link:

sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin

I then edited http.conf to add AllowOverride all to <Directory "/var/www/html">. (Command: sudo nano /etc/httpd/conf/httpd.conf)

And then restarted the server:

sudo service httpd restart

But whenever I visit http://ec2-xx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com/phpmyadmin I get a 403 Forbidden response from the server: You don't have permission to access /phpmyadmin on this server.

I feel like I'm missing something really obvious, but I cannot figure out what.

like image 314
Chuck Le Butt Avatar asked Feb 04 '15 15:02

Chuck Le Butt


People also ask

Does AWS have phpMyAdmin?

phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL, MariaDB, and AWS Aurora over the Web. phpMyAdmin is a free software tool written in PHP, intended to handle the administration of MySQL, MariaDB, and AWS Aurora over the Web.

Can we install database in EC2 instance?

Follow the steps below to install MySQL on AWS EC2: Step 1: Create an AWS Elastic Cloud Compute Instance.. Step 2: Start the EC2 instance that you have created in Step 1. Step 3: Connect to your EC2 Instance by clicking on Connect Button.

How do I access AWS phpMyAdmin?

In RDS Security group open inbound port 3306 to give phpMyAdmin access to MySQL. You can give which IP address of the server where phpMyAdmin is installed in the Security group. Now log in to phpMyAdmin using the password you created by visiting the URL: https:///phpmyadmin.


2 Answers

I needed to update the /etc/httpd/conf.d/phpMyAdmin.conf to allow remote users.

I just replaced the contents of the first <directory> tag like so...

I removed:

<Directory /usr/share/phpMyAdmin/>
 AddDefaultCharset UTF-8

 <IfModule mod_authz_core.c>
  # Apache 2.4
  <RequireAny>
    Require ip 127.0.0.1
    Require ip ::1
  </RequireAny>
 </IfModule>
 <IfModule !mod_authz_core.c>
  # Apache 2.2
  Order Deny,Allow
  Deny from All
  Allow from 127.0.0.1
  Allow from ::1
 </IfModule>
</Directory>

And replaced it with this:

<Directory /usr/share/phpMyAdmin/>
 AddDefaultCharset UTF-8

 Order allow,deny
 Allow from all
</Directory>

And restarted the server: sudo service httpd restart

Works now!

like image 63
Chuck Le Butt Avatar answered Oct 14 '22 04:10

Chuck Le Butt


I had the same issue, and Chuck Le Butt's solution was very helpful, although a little different for me...

My ISP uses dynamic IP addresses so when I setup the server it was via a different IP. When I returned to it the following day, my IP address had changed so I was forbidden. Butt, rather than allowing access from all IP's as Chuck suggested, I've updated my previous IP addresses in the phpMyAdmin.conf file.

sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
like image 30
Shane McCarthy Avatar answered Oct 14 '22 04:10

Shane McCarthy