GalaxyData Community

How to Install PHPMyAdmin 4.7 on CentOS/RHEL 7/6 & Fedora 27/26/25

PhpMyAdmin is a well most popular web-based client for managing MySQL server. PHPMyAdmin is written in PHP programming language. It provides a user-friendly web interface to access and manage your databases. To ease usage to a wide range of people, phpMyAdmin is being translated into 72 languages and supports both LTR and RTL languages. This article will help you to install phpMyAdmin on CentOS/RedHat System.

Prerequsities

In order to use PHPMyAdmin, you must have PHP, MySQL and Apache installed on your system. Also, you need PHP-MySQL or PHP-MySQLi module enabled in PHP configuration. For the current version of PHPMyAdmin 4.7.2, the requirements are as follows.

Use the tutorial: Installing Apache MySQL PHP on CentOS and RedHat

Enable Remi Repository

phpMyAdmin most updated package is available in Remi repository. Install it in your system using following commands.

### CentOS/RHEL 7 ###
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

### CentOS/RHEL 6 ###
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

### Fedora 27 ###
rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-27.rpm

### Fedora 26 ###
rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-26.rpm

### Fedora 25 ###
rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-25.rpm

Install PhpMyAdmin

After enabling Remi repository on your system, let’s start the with the installation of phpMyAdmin using yum package manager. All the dependencies will automatically be installed.

yum --enablerepo=remi,remi-test  install phpMyAdmin httpd php

Configure PhpMyAdmin

phpMyAdmin by default allowed to access from localhost only. If you want to make it accessible from remote computers edit /etc/httpd/conf.d/phpMyAdmin.conf and update all 127.0.0.1 with your network like below or enable phpMyAdmin access for everyone.

cat << EOT > /etc/httpd/conf.d/phpMyAdmin.conf

# phpMyAdmin - Web based MySQL browser written in php
# 
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>

Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted

   AddDefaultCharset UTF-8

   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
      #ADD following line:
       Require all granted
       Require ip 127.0.0.1
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     #CHANGE following 2 lines:
     Order Allow,Deny
     Allow from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   <IfModule mod_authz_core.c>
     # Apache 2.4
     <RequireAny>
        #ADD following line:
       Require all granted
       Require ip 127.0.0.1
       Require ip ::1
     </RequireAny>
   </IfModule>
   <IfModule !mod_authz_core.c>
       # Apache 2.2
     #CHANGE following 2 lines:
     Order Allow,Deny
     Allow from All
     Allow from 127.0.0.1
     Allow from ::1
   </IfModule>
</Directory>

# These directories do not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
<Directory /usr/share/phpMyAdmin/libraries/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/lib/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

<Directory /usr/share/phpMyAdmin/setup/frames/>
    Order Deny,Allow
    Deny from All
    Allow from None
</Directory>

# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc.  This may break your mod_security implementation.
#
#<IfModule mod_security.c>
#    <Directory /usr/share/phpMyAdmin/>
#        SecRuleInheritance Off
#    </Directory>
#</IfModule>
 

EOT

Add Rulse Firewall

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --zone=public --add-service=mysql --permanent
firewall-cmd --reload

 

After updating phpMyAdmin Apache configuration file, restart Apache service to reload new settings.

systemctl restart httpd

Access phpMyAdmin in Browser

Now you can access phpMyAdmin in a browser using the following URL. Change svr1.tecadmin.net with your server IP/FQDN.

http://mysql.galaxydata.ru/phpMyAdmin/

Login Details: Use MySQL username and password.

Congratulation’s You have successfully installed phpMyAdmin. Using single phpMyAdmin we can manage multiple MySQL servers by adding multiple remote MySQL server. Use this article to add multiple MySQL hosts in phpMyAdmin.

Exit mobile version