LAMP on CentOS – phpMyAdmin

A LAMP (Linux, Apache, MySQL, PHP) stack is a common web stack used for hosting web content.

MySQL administration via command-line in Linux is very difficult job for any newbie system administrator or database administrator.

PhpMyAdmin is a web-based interface for managing MySQL / MariaDB databases that is used as a replacement for command-line utilities.

It was written in PHP language, through this application you can do various MySQL administration tasks such as create, drop, alter, delete, import, export, search, query, repair, optimize and run other database management command via browser.

1: EPEL and Remi Repositories

To install most recent version of PhpMyAdmin (i.e. 4.6), you need to install and enable EPEL and Remi repositories on your respective Linux distributions as shown:

# rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

2: Installing PhpMyAdmin Web Interface

Once you’ve installed above repositories, now its’ time to install PhpMyAdmin with the help of following command as shown.

# yum --enablerepo=remi install phpmyadmin

Note : If your are using PHP 5.4 on RHEL/CentOS/Fedora systems, then you need to run the below command to install it.

# yum --enablerepo=remi,remi-test install phpmyadmin

3: Configuring PhpMyAdmin for Apache or Nginx

In Apache you don’t need to configure anything for phpMyAdmin, because you will get working phpMyAdmin automatically at the address http:///phpmyadmin.

The main configuration file is located under /etc/httpd/conf.d/phpMyAdmin.conf, make sure the Require all granted directive (For Apache 2.4) and Allow from &ltip address> is added inside the Directory /usr/share/phpmyadmin block.

Finally, restart Apache to apply changes.
# systemctl restart httpd

On the Nginx web server, we will create a symbolic link to PhpMyAdmin installation files to our Nginx web document root directory (i.e. /usr/share/nginx/html) by running the following command:

# ln -s /usr/share/phpMyAdmin /usr/share/nginx/html

restart Nginx and PHP-FPM to apply changes.
# systemctl restart nginx
# systemctl restart php-fpm

4: Accessing PhpMyAdmin Web Interface

Open your browser and point your browser to http:///phpmyadmin. It should open the phpmyadmin interface (as shown in the image below).

Useful Links

 


Step by step, installing Apache, MariaDB, PHP, and phpMyAdmin

  1. Part 1: Install Apache on RHEL/CentOS 7
  2. Part 2: Install MariaDB on RHEL/CentOS 7
  3. Part 3: Install PHP on RHEL/CentOS 7
  4. Part 4: Install phpMyAdmin on RHEL/CentOS 7

Thats all for now!

You may also like: