phpMyAdmin-logoThis is guide, howto install phpMyAdmin 4.3.10 with Nginx or Apache on Fedora 21/20/19, CentOS 7/6.6/5.11 and Red Hat (RHEL) 7/6.6/5.11 servers. phpMyAdmin needs web server with PHP and MySQL database. This guide uses Apache web server with PHP 5.6 or Nginx web server with PHP 5.6 (PHP-FPM) and MySQL 5.6 database server or MariaDB 10/5.5 database server. You can also use your already installed versions of web server, PHP and MySQL.

If you want to install phpMyAdmin with Apache then use a – [Apache] sections and if you want install phpMyAdmin with Nginx then use b – [Nginx] sections.

1. Install Needed Web and Database Servers

[Apache]

1.1a Install the whole LAMP environment with following guide

LAMP (Linux/Apache/MySQL/PHP) on Fedora, CentOS/Red Hat (RHEL)

[Nginx]

1.1b Install the whole LEMP environment with following guide

LEMP (Linux/Nginx/MySQL/PHP) on Fedora, CentOS/Red Hat (RHEL)

OR

[Apache]

1.2a Install just MySQL and Apache with PHP using following guides

  1. Install MySQL 5.6 on Fedora, CentOS, Red Hat (RHEL) OR MariaDB 10/5.5 on Fedora, CentOS, Red Hat (RHEL)
  2. Install Apache (httpd) and PHP 5.6 on Fedora, CentOS, Red Hat (RHEL)

[Nginx]

1.2b Install just MySQL and Nginx with PHP (PHP-FPM) using following guides

  1. Install MySQL 5.6 on Fedora, CentOS, Red Hat (RHEL) OR MariaDB 10/5.5 on Fedora, CentOS, Red Hat (RHEL)
  2. Install Nginx and PHP 5.6 (PHP-FPM) on Fedora, CentOS, Red Hat (RHEL)

2. Install phpMyAdmin 4.2.1 on Fedora 21/20/19, CentOS/Red Hat (RHEL) 7/6.6/5.11

2.1 Change root user


su -
## OR ##
sudo -i

2.2 Install Remi repository

Fedora


## Remi Dependency on Fedora (if available) ##
rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm 
rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

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

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

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

CentOS and Red Hat (RHEL)


## Remi Dependency on CentOS 7 and Red Hat (RHEL) 7 ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
 
## CentOS 7 and Red Hat (RHEL) 7 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
 
## CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
 
 
## Remi Dependency on CentOS 5 and Red Hat (RHEL) 5 ##
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
 
## CentOS 5 and Red Hat (RHEL) 5 ## 
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

Note: You can also use original Fedora phpMyAdmin builds or EPEL packages.

2.3 Install phpMyAdmin

2.3.1 Fedora 21


yum --enablerepo=remi install phpmyadmin

2.3.2 Fedora 20/19, CentOS 7/6.6/5.11 and Red Hat (RHEL) 7/6.6/5.11


yum --enablerepo=remi,remi-php56 install phpmyadmin

3. Setup phpMyAdmin with Apache or Nginx

[Apache]

3.1a Check phpMyAdmin Apache Virtual Host

When you install phpMyAdmin you got working Apache Virtual Host automatically, but if you want change it, then check /etc/httpd/conf.d/phpMyAdmin.conf file and modify it.

[Nginx]

3.1b Check or Create phpMyAdmin Nginx Virtual Host

You can use default phpMyAdmin nginx virtual host conf on /etc/httpd/default.d/phpMyAdmin.conf or you can create your own virtual host config.

I use here custom custom version of phpMyAdmin conf. First create /etc/nginx/sites-available/phpMyAdmin file with following content:


server {
       listen   80;
       server_name pma;
       access_log /var/log/nginx/phpmyadmin/access.log;
       error_log /var/log/nginx/phpmyadmin/error.log;
       root /usr/share/phpMyAdmin;

       location / {
           index  index.php;
       }

       ## Images and static content is treated different
       location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
           access_log        off;
           expires           360d;
       }

       location ~ /\.ht {
           deny  all;
       }

       location ~ /(libraries|setup/frames|setup/libs) {
           deny all;
           return 404;
       }

       location ~ \.php$ {
           include /etc/nginx/fastcgi_params;
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           fastcgi_param SCRIPT_FILENAME $root$fastcgi_script_name;
       }
}

This is Nginx phpMyAdmin virtual host configuration which works pretty much like original phpMyAdmin Apache configuration. I use here server_name pma you could freely change this real host name or some other.

Set pma pointing to localhost, add following to /etc/hosts file:


127.0.0.1  pma

Create needed directory and enable Nginx virtual host:


mkdir -p /var/log/nginx/phpmyadmin

cd /etc/nginx/sites-enabled
ln -s /etc/nginx/sites-available/phpMyAdmin

[Apache]

3.2a Restart Apache Web Server


## Fedora 21/20/19 and CentOS/RHEL 7 ##
systemctl restart httpd.service
 
## CentOS/RHEL 6.6/5.11 ##
service httpd restart
## OR ##
/etc/init.d/httpd restart

[Nginx]

3.2b Restart Nginx Web Server


## Fedora 21/20/19 and CentOS/RHEL 7 ##
systemctl restart nginx.service
 
## CentOS/RHEL 6.6/5.11 ##
service nginx restart
## OR ##
/etc/init.d/nginx restart

4. Use phpMyAdmin

[Apache]

4.1a Open phpMyAdmin with Apache Setup

Open browser and Goto following address http://localhost/phpmyadmin.

[Nginx]

4.1b Open phpMyAdmin with Nginx Setup

Open browser and Goto following address http://pma/. Or if you use default phpMyAdmin config, then goto following address http://localhost/phpMyAdmin.

4.2 phpMyAdmin Login Screen

Login with your MySQL username and password.
phpMyAdmin Login

[Apache]

4.3a phpMyAdmin 4.3.10 Running on Fedora 21 with Apache

phpMyAdmin with Apache on Fedora 21

[Nginx]

4.3b phpMyAdmin 4.3.10 Running on Fedora 21 with Nginx

phpMyAdmin with nginx on Fedora 21