Skip to content

Instantly share code, notes, and snippets.

@jimitit
Last active August 29, 2015 14:14
Show Gist options
  • Save jimitit/c2445cbf56537689b32a to your computer and use it in GitHub Desktop.
Save jimitit/c2445cbf56537689b32a to your computer and use it in GitHub Desktop.
Configuring PhpMyAdmin on Amazon EC2 to manage Amazon RDS
#Follow below simple steps to install PhpMyAdmin on EC2
# 1) Installing through repositories by enabling epel. To install phpmyadmin package.
sudo yum --enablerepo=epel install phpmyadmin
# 2) Navigate to file “/etc/httpd/conf.d/phpMyAdmin.conf” and make sure you can access phpMyAdmin from outside (your local pc).
<Directory /usr/share/phpMyAdmin/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
# Require ip 127.0.0.1
Require ip <Add-your-IP>
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 <Add-your-IP>
Allow from ::1
</IfModule>
</Directory>
# 3) Edit mysql host in config.inc.php file
# In order to access RDS database, we need to modify mysql host in config.inc.php file.
# Most of the blogs across web points to /usr/share/phpMyAdmin folder and copying config.sample.inc.php as config.inc.php.
# But modifying mysql host in this file didn’t work for me.
# In order to get that working, I had to modify config.inc.php in /etc/phpMyAdmin.
sudo vi /etc/phpMyAdmin/config.inc.php
# Modify
$cfg['Servers'][$i]['host'] = 'localhost';
# To
$cfg['Servers'][$i]['host'] = 'xxxxxxxxxxx.cny3hl5jk7fs.us-east-1.rds.amazonaws.com'; //Your-RDS-Instance-Endpoint
# 4) Perform httpd restart
sudo service httpd restart
# 5) Browse PhpMyAdmin on your browser
http://<Elastic-IP-Address>/phpmyadmin
# Note: If you face "Forbidden" error while accesing via URL. You ned to make sure AllowOverride All in httpd.conf file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment