How to Install phpMyAdmin with Apache on CentOS 7

How to Install phpMyAdmin with Apache on CentOS 7
How to Install phpMyAdmin with Apache on CentOS 7

Using a GUI (Graphic User Interface) is indeed more convenient for people who are not familiar with a number of commands in the CLI (Command Line Interface) which consists of a line of scripts In addition, you also have to master certain commands when using the CLI. Therefore, learn how to install phpMyAdmin with Apache on CentOS 7 below to make managing your database easier .

What is phpMyAdmin?

phpMyAdmin is a free software based on the PHP scripting language that can make it easier for developers to manage MySQL databases. This software supports several database operations such as MariaDB, MySQL, and Drizzle so you can manage databases , tables, indexes to users . In addition, you can also execute  SQL statements directly from phpMyAdmin.

How to Install phpMyAdmin with Apache on CentOS 7

Before starting the phpMyAdmin installation process, there are a few things you need to prepare first:

  • VPS with CentOS 7 operating system.
  • Domain that has been redirected to the VPS IP.
  • Access to  root as Administrator.

The following are some points for the installation steps that we will do:

  • Update Server
  • Install Packages
  • Install Firewall
  • Install Apache Web Server
  • Install PHP 7.2
  • Install PHP-FPM
  • Install Database Server
  • Install phpMyAdmin
  • Config phpMyAdmin
  • Testing

Update Server

Login as root to the server and update the server with the following command:

$ yum update -y
$ reboot

Install Packages

Install some of the packages needed for CentOS 7.

$ yum install wget nano perl zip unzip -y

Install Firewall

Before starting, you need to install a firewall to make it more secure . In this tutorial how to  install  phpMyAdmin with Apache on CentOS 7, we use CSF (ConfigServer Security & Firewall). The installation is done with the command below:

$ cd /usr/src
$ wget
$ tar -xzf csf.tgz
$ cd csf/
$ sh

In CSF configuration change “make TESTING=’1′ to 0”.

$ nano /etc/csf/csf.conf

Then add port 9000 on TCP_Out and TCP_In for phpMyAdmin purposes. After that restart the CSF so that it simultaneously reloads the updated configuration results .

$ csf -r 

Install Apache Web Server

Considering Apache is the web server that will be used in this article, then you also need to install Apache Web Server first. Use the following command:

$ yum install httpd -y

Check the Apache version you are using:

$ httpd -v
Server version: Apache/2.4.6 (CentOS) 
Server built:   Nov 16 2020 16:18:20

The version we currently install is version 2.4.6, there may be differences from the one you install later, depending on the latest version of Apache updates. Then, start and enable on-boot Apache:

$ systemctl start httpd
$ systemctl enable httpd

Install PHP 7.2

We are using PHP version 7.2. Before starting to use it, you need to activate the repo and install yum-utils , then install some necessary extensions.

$ rpm -Uvh
$ yum install yum-utils -y
$ yum update -y

Activate PHP 7.2 and install the extension

$ yum-config-manager --enable remi-php72
$ yum install php php-gd php-json php-mbstring php-mysqlnd php-xml php-xmlrpc php-opcache -y

Also Read:  How to Install WHM, cPanel, PHP and Firewall on CentOS 7 Server

Install PHP-FPM

PHP-FPM (FastCGI Process Manager) is an alternative to the FastCGI implementation for the PHP programming language. PHP-FPM is also a separate PHP interpreter from the web server so that every PHP script request that enters the web server will be forwarded or forwarded to FastCGI via a TCP/IP connection socket. Follow the below command for PHP-FPM installation.

$ yum install php-fpm -y

Start dan enable on-boot PHP-FPM:

$ systemctl start php-fpm
$ systemctl enable php-fpm

Check the status of PHP-FPM is active or not:

$ systemctl status php-fpm
  • php-fpm.service – The PHP FastCGI Process Manager   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-11-19 07:00:39 UTC; 12s ago
 Main PID: 15285 (php-fpm)
   Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
   CGroup: /system.slice/php-fpm.service
           ├─15285 php-fpm: master process (/etc/php-fpm.conf)
           ├─15287 php-fpm: pool www
           ├─15288 php-fpm: pool www
           ├─15289 php-fpm: pool www
           ├─15290 php-fpm: pool www
           └─15291 php-fpm: pool www

Install Database Server

The database server used for installing phpMyAdmin with Apache on CentOS 7 is MariaDB, because MariaDB is the most up-to-date and compatible database server today. 

$ yum install mariadb-server mariadb -y

Start and enable on-boot MariaDB service then do a secure installation .

$ systemctl enable mariadb
$ systemctl start mariadb
$ mysql_secure_installation
Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

Remove anonymous users? [Y/n] y
 ... Success!

Disallow root login remotely? [Y/n] y
 ... Success!

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Just click Enter in the current password for root l section, then set root password and so on select Y until the security installation process is complete. After that check whether MariaDB status is active or not:

$ systemctl status mariadb
  • mariadb.service – MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2020-11-19 06:28:36 UTC; 22s ago
  Process: 14043 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
  Process: 13960 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
 Main PID: 14042 (mysqld_safe)

Install phpMyAdmin

The process of installing phpMyAdmin will be done using the YUM Package Manager from the official CentOS party.

$ yum install phpmyadmin -y

Config phpMyAdmin

After the phpMyAdmin installation is complete, you will need to do some configuration in phpMyAdmin.

$ nano /etc/httpd/conf.d/phpMyAdmin.conf

Change the require IP to allowoverride all to make it publicly accessible. However, if you only want to be accessible to certain IPs, you can change from to the IP you want. In this article, we will change it to make it publicly accessible.

In the line Require IP or Allow from is changed to the IP Address of the network you are using, check the IP Address of the network in WhatIsMyIp .

Deny From All, changed to Deny From None.

Allow From None, Allow From All.

If it is appropriate, save and then exit.

$ nano /etc/httpd/conf/httpd.conf

Add index.php to dir_module:

<IfModule dir_module> 
DirectoryIndex index.php index.html 

Then save and exit. Then  restart the Apache service:

$ systemctl restart httpd


How to install phpMyAdmin with Apache on CentOS 7 is almost complete, now you only need to access the pointed domain or access your VPS IP by adding “/phpmyadmin”. If successful, then it will look like below.

After you login using the root username and password according to the mysql_secure_installation setup earlier, the result will be like this, namely the  phpMyAdmin dashboard  display.


phpMyAdmin really needs to be used for those of you who are not familiar with a collection of scripts and commands like the CLI. Apart from having a user-friendly GUI, this software also has complete features.

That’s the article on how to  install phpMyAdmin with Apache on CentOS 7, don’t hesitate to leave topic ideas you want to read on price4india,com, Hope this article helps, good luck!

guru hosting

Guru Hosting Review: Get Fastest Hosting Services in UK

How to Install WHM, cPanel, PHP and Firewall on CentOS 7 Server