December 10, 2024
how-to-install-phpmyadmin-on-centos7-for-PHP7

Install phpMyAdmin on CentOS 7 for PHP 7

This is a short guide on how to install PHPMyAdmin on CentOS 7 server. In this guide, we will see how to install PHPMyAdmin manually.

Important: Epel repository provides a phpMyAdmin package for PHP 5, But it is not compatible with PHP 7. For PHP 7, we need to manually download and set up the phpMyAdmin web interface.

Download phpMyAdmin for CentOS 7

You can download the latest version of phpMyAdmin from the following link

https://www.phpmyadmin.net/downloads/

Now lets start with the installation process:

Step 1: Go to /usr/share directory

Step 2: Download phpMyAdmin package using the command:

curl -O https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-all-languages.zip

Step 3: Unzip the file using the following command:

unzip phpMyAdmin-5.0.2-all-languages.zip

If the unzip command does not work means you will have to install the unzip package on your CentOS 7 Server.

You can install unzip on your centos 7 server using the following command:

yum install unzip

Step 4: Rename the extracted folder using the command:

mv phpMyAdmin-5.0.2-all-languages.zip phpmyadmin

Step 5: Create apache configuration file in httpd directory:

vi /etc/httpd/conf.d/phpmyadmin.conf

Add the configuration as follows:

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

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

    <IfModule mod_authz_core.c>
      # Apache 2.4
      <RequireAny>
        Require all granted
        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>

<Directory /usr/share/phpmyadmin/setup/>
    <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>

# 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>

Save the file and restart the your httpd server using the command as follows:

systemctl restart httpd

Congrats you have successfully install PHPMyAdmin on your CentOS 7. To open phpMyAdmin type http://server_ip/phpmyadmin then You should see the login page.

Vedant Kumar

Currently I'm working as an Implementation Engineer, Started my career as an System Administrator - Linux. Additionally loves to explore new technologies and research about new open-source software that ease the development cycle.

View all posts by Vedant Kumar →

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

close

Ad Blocker Detected!

VEDANT EXPLAINS
We've noticed that you are using an ad blocker. Advertising helps fund our server cost and keep it truly independent. It helps to build our content creator team. So please disable your ad blocker, and help us to keep providing you with free- great content - for free. Thank you for your support.

Refresh