Did You Know?
Donate to TecMint

We are pleased to announce our new TecMint Q/A section to submit your Linux questions

PhpMyAdmin 4.2.2 Released – Install for Apache or Nginx on RHEL/CentOS 6.5/5.9 Fedora 20-12

Download Your Free eBooks NOW - 10 Free Linux eBooks for Administrators

MySQL administration via command-line in Linux is much difficult job for any newbie system administrator or database administrator, because it contains numerous commands which we cannot remember in our daily life. To make MySQL administration much easier we’re introducing a web based MySQL administration tool called PhpMyAdmin, with the help of this tool you can control and manage your database administration via browser easily.

On May 20th 2014, a new version of phpMyAdmin 4.2.2 has been released and comes with a minor crucial fixes and few important changes.

Install PhpMyAdmin for Apache or Nginx

Install PhpMyAdmin for Apache or Nginx

What Is PhpMyAdmin?

PhpMyAdmin is an open source and most popular web based MySQL administration application for handling MySQL databases. 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.

In this article we’re going to learn how to install latest released PhpMyAdmin 4.2.2 for Apache or Nginx on RHEL 6.5/6.4/6.3/6.2/6.1/6/5.9/5.8, CentOS 6.4/6.3/6.2/6.1/6/5.9/5.8 and Fedora 20,19,18,17,16,15,14,13,12 systems using Yum repositories.

Here we’ve provided installation of PhpMyAdmin 4.2.2 for both the web server’s Apache or Nginx. So, its up-to you which web server to choose for installation. But remember you must have working LAMP (Linux, Apache, PHP and MySQL) or LEMP (Linux, Nginx, PHP and MySQL) setup installed on your working system. If you don’t have any of them, then follow our below articles to setup.

Read Also : SQL Buddy (A Lightweight MySQL Administration) Tool for RHEL / CentOS / Fedora

Install Linux – RHEL 6, CentOS 6.5, Fedora 19 and Fedora 18

  1. Red Hat Enterprise Linux (RHEL) 6 Installation Guide with Screenshots
  2. CentOS 6.5 Step by Step Installation Guide with Screenshots
  3. Fedora 19 Step by Step Installation Guide with Screenshots
  4. Fedora 18 Step by Step Installation Guide with Screenshots

Install LAMP (Linux, Apache, MySQL, PHP) Setup

  1. Install Apache 2.2.15, MySQL 5.5.34 & PHP 5.5.4 on RHEL/CentOS 6.5/5.9 & Fedora 20-12

Install LEMP (Linux, Nginx, MySQL, PHP) Setup

  1. Install LEMP (Linux, Nginx, MySQL, PHP) on RHEL/CentOS 5-6 & Fedora 20-12

Install phpMyAdmin 4.2.2 on RHEL/CentOS 6.5/5.9 Fedora 20-12

Step 1: Install Required Repositories for PhpMyAdmin 4.2.2

First, install dependency packages using following repositories.

[For RHEL/CentOS 6.5/5.9 - 32 Bit OS]
## Epel Dependency on RHEL/CentOS 6 ##
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

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

## Epel Dependency on RHEL/CentOS 5 ##
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

## Remi Dependency on RHEL/CentOS 5 ##
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
[For RHEL/CentOS 6.5/5.9 - 64 Bit OS]
## Epel Dependency on RHEL/CentOS 6 ##
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

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

## Epel Dependency on RHEL/CentOS 5 ##
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

## Remi Dependency on RHEL/CentOS 5 ##
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
[For Fedora 20-12]
## Remi Dependency on Fedora 20,19,18,17,16,15,14,13,12 ##
# 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

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

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

## Remi Dependency on Fedora 18 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-18.rpm

## Remi Dependency on Fedora 17 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-17.rpm

## Remi Dependency on Fedora 16 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-16.rpm

## Remi Dependency on Fedora 15 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-15.rpm

## Remi Dependency on Fedora 14 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-14.rpm

## Remi Dependency on Fedora 13 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-13.rpm

## Remi Dependency on Fedora 12 ##
rpm -Uvh http://rpms.famillecollet.com/remi-release-12.rpm

Step 2: Install PhpMyAdmin 4.2.2

Once you’ve installed above repositories, you can run the following command to install it.

# yum --enablerepo=remi install phpmyadmin

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

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

Step 3: Configuring PhpMyAdmin for Apache or Nginx

[For Apache]

In Apache you don’t need to setup any Virtual Host for phpMyAdmin, because you will get working phpMyAdmin automatically. The main configuration file is located under /etc/httpd/conf.d/phpMyAdmin.conf.

[For Nginx]

For Nginx you need to setup and create Virtual Host file manually by creating following file.

# vi etc/nginx/sites-available/phpMyAdmin

Add the following whole code to it, save and exit. In the below configuration file, I have chosen server name as tecmint, you could change it to any as per your choice.

server {
       listen   80;
       server_name tecmint;
       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 /usr/share/phpMyAdmin$fastcgi_script_name;
       }
}

Now set server name tecmint to localhost, To do this, just add the following entry in your /etc/hosts file.

127.0.0.1  tecmint

Now create required directory and enable Nginx virtual host for phpmyadmin.

# mkdir -p /var/log/nginx/phpmyadmin
# cd /etc/nginx/sites-enabled
# ln -s /etc/nginx/sites-available/phpMyAdmin

Step 4: Restarting Apache or Nginx Service

Once you all set, now restart the service based on your selected web server.

[Restart Apache]
# /etc/init.d/httpd restart
OR
# service httpd restart
[Restart Nginx]
# /etc/init.d/nginx restart
OR
# service nginx restart

Step 5: Starting PhpMyAdmin

[Start PhpMyAdmin on Apache]

Open your browser and type the URL as http://localhost/phpmyadmin.

PhpMyAdmin Welcome Screen in Apache

PhpMyAdmin Welcome Screen in Apache

[Start PhpMyAdmin on Nginx]

Open your browser and type the URL as http://tecmint.

PhpMyAdmin Welcome Screen in Nginx

PhpMyAdmin Welcome Screen in Nginx

Ravi Saive

Owner at TecMint.com
Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.

Linux Services & Free WordPress Setup

Our post is simply ‘DIY’ aka ‘Do It Yourself, still you may find difficulties and want us to help you out. We offer wide range of Linux and Web Hosting Solutions at fair minimum rates. Please submit your orders by Clicking Here.

30 Responses

  1. christopher says:

    # cd /etc/nginx/sites-enabled should be sites-available as per your original quote

  2. Pejman says:

    Dear Ravi,

    Please write some articles about Nginx and its installation on CentOS

  3. Mateoo says:

    Hi,
    i have problem, after the installation process displays a message to me at phpmy admin: You do not have permission to access / phpmyadmin on this server .. Please help

    • hello, open “/etc/httpd/conf.d/phpmyadmin.conf”

      and find;

      Order Deny,Allow
      Deny from All
      #Allow from 127.0.0.1
      Allow from ::1

      change;

      Order Deny,Allow
      #Deny from All
      ##Allow from 127.0.0.1
      Allow from ::1

      and will work..

  4. Ravi Saive says:

    Open this /etc/httpd/conf.d/phpMyAdmin.conf with vi editor and add your IP address in allow from and then restart web service.

  5. Paul Srch says:

    When I use the setup facility to configure phpMyAdmin after this, I can’t seem to figure out where to move the config.inc.php file. I’ve done a “find” and have come up with these three directories:

    /etc/phpMyAdmin
    /var/lib/phpMyAdmin
    /usr/share/phpMyAdmin

    Once I’ve done the setup utility, I get the message to move config/config.inc.php from the config directory to the main directory for phpMyAdmin. The one in /var/lib/phpMyAdmin/config/config.inc.php seems to have the changes I made, and I moved it to /var/lib/phpMyAdmin/config.inc.php, and then logged out and back in, but the changes did not seem to be there.

    Any ideas?

  6. Souradip Roy says:

    Every time when I am trying to install php,it is showing me the following error PLEASE HELP ……….. please show me a way to resolve this php-gd-5.4.13-1 problem ……

    Error: Package: php-gd-5.4.13-1.el6.remi.i686 (remi)
    Requires: libjpeg.so.62(LIBJPEG_6.2)
    Error: Package: php-gd-5.4.13-1.el6.remi.i686 (remi)
    Requires: php-common(x86-32) = 5.4.13-1.el6.remi
    Installed: php-common-5.5.0-0.22.beta2.el6.remi.i686 (@remi-test)
    php-common(x86-32) = 5.5.0-0.22.beta2.el6.remi
    Available: php-common-5.3.2-6.el6.i686 (rhel6repo)
    php-common(x86-32) = 5.3.2-6.el6
    Available: php-common-5.4.12-1.el6.remi.i686 (remi)
    php-common(x86-32) = 5.4.12-1.el6.remi
    Available: php-common-5.4.13-1.el6.remi.i686 (remi)
    php-common(x86-32) = 5.4.13-1.el6.remi
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest

    • Ravi Saive says:

      To overcome this issue, first remove the php-gd and php-common packages using.

      yum remove php-gd php-common
      

      and then try again to install php. I hope it will work..

  7. Guru says:

    Note that on CentOS 6.4, when I run yum –enablerepo=remi,remi-test install phpmyadmin
    it gives my phpmyadmin version 2.
    I must run yum –enablerepo=remi,remi-test install phpMyAdmin
    With capitals, in order for it to give me version 4

  8. Corey Jones says:

    After following both this tutorial http://www.tecmint.com/install-lemp-linux-nginx-mysql-php-on-rhel-centos-5-6-fedora-12-17/

    And this one. I end up with 404 page not found when i enter http://*theIP*/phpmyadmin/

    I have tried this about 3 times now. With no luck. The web server is working fine as I can go to http://*theIP* and phpinfo and both work fine. Do you have any idea why i’m getting these 404 errors. Running Centos6.4 on a digital ocean box. Thanks

  9. Dr.D.K.Samuel says:

    Thanks it worked as a charm in fedora 19 64 bits

    Will you please write on setting up mongodb and Postgresql on fedora 19 64 bits please

  10. John says:

    Worked great! Thanks, Ravi!
    For logging in, I didn’t have to enter a root password.
    The command in Terminal:

    mysqladmin -u root password NEWPASSWORD

    worked. I was able to login into PhpMyAdmin immediately.

  11. Jegs Meganu says:

    I think there’s 1 thing that you forgot to add on your documentation, the starting of mysqld because when I check the service mysqld status it says mysqld is stopped so I have to run by typing service mysqld start

  12. siddharth says:

    I tried installing phpmy admin , and followed all still i get access denied error.

  13. Raj says:

    Hello,

    I get “403 Forbidden” when I try to access PHPMyAdmin through the web browser.

    The error log says this
    ] 8923#0: *1 directory index of “/usr/share/nginx/html/phpMyAdmin/” is forbidden, client: 127.0.0.1, server: tecmint, request: “GET / HTTP/1.1″, host: “tecmint”

    My PHP config is as below

    cat /etc/httpd/conf.d/phpMyAdmin.conf

    [root@centos html]# vim /etc/httpd/conf.d/phpMyAdmin.conf
    [root@centos html]# cat /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

    # Apache 2.4
    Require local

    # Apache 2.2
    Order Deny,Allow
    Deny from All
    Allow from 127.0.0.1
    Allow from ::1

    # Apache 2.4
    Require local

    # Apache 2.2
    Order Deny,Allow
    #Deny from All
    Allow from 127.0.0.1
    Allow from ::1

    # These directories do not require access over HTTP – taken from the original
    # phpMyAdmin upstream tarball
    #

    Order Deny,Allow
    Deny from All
    Allow from None

    Order Deny,Allow
    Deny from All
    Allow from None

    Order Deny,Allow
    Deny from All
    Allow from None

    # This configuration prevents mod_security at phpMyAdmin directories from
    # filtering SQL etc. This may break your mod_security implementation.
    #
    #
    #
    # SecRuleInheritance Off
    #
    #

    Please could you help me?

  14. Raj says:

    Hello,

    I fixed the problem. I moved the phPMyAdmin directory to the document root location. :) My bad that I had missed this earlier. All good

    Cheers!

  15. Yobs says:

    Hi,

    When I try to access the PhpMyAdmin in a web browser and I try to log in using “root”, it says:

    #1045 Cannot log in to the MySQL server

    Will there be a default username and password that I can use after the installation?

    Please help.

    Thank you.

  16. Martin says:

    Hi,

    I try to install it but I get some mistake

    –> Finished Dependency Resolution
    Error: php55w-common conflicts with php-common-5.4.23-1.el6.remi.x86_64
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest

    And with –skip-broken:

    Packages skipped because of dependency problems:
    dejavu-sans-fonts-2.30-2.el6.noarch from base
    php-common-5.4.23-1.el6.remi.x86_64 from remi
    php-php-gettext-1.0.11-4.el6.remi.noarch from remi
    php-tcpdf-6.0.053-1.el6.remi.noarch from remi
    php-tcpdf-dejavu-sans-fonts-6.0.053-1.el6.remi.noarch from remi
    php-xml-5.4.23-1.el6.remi.x86_64 from remi
    phpMyAdmin-4.1.4-1.el6.remi.noarch from remi

    YOU have a idea why I have php 5.5.7 on my server Centos 6.5

    • Ravi Saive says:

      Remove the older version of php55w-common using below command.

      # yum remove php55w-common
      

      And then try to install it again.

  17. Ananda says:

    I have already running phpmyadmin 2.11.11.3 with Apache2, PHP Version 5.3.3 & mysql

    5.1.71 in CentOS release 6.4 (Final) .

    Will you please share how to upgrade PhpMyAdmin 4.1.2 in this server .

  18. Masoud says:

    after installing phpMyAdmin and creating a symbolic link of phpMyAdmin in /usr/share/nginx/html when i try to access mydomain/phpMyAdmin i get the following error :

    Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly

    any help is appreciated in advance

  19. Zirius says:

    Tried it 404.

    Anyways, I suggest that you clear up what is the “server” for,

    I followed the nginx format, tried IP/phpmyadmin and produced 404 error.

    Did I expect different output from this guide?

    So what should I do so that I can access phpmyadmin tru: IP/phpmyadmin

    Thanks.

  20. Niks says:

    Hi,

    “sites-available” for CentOS? Are you sure? CentOs not Debian ..

Leave a Reply

This work is licensed under a (cc) BY-NC | TecMint uses cookies. By using our services, you comply to use of our cookies. More info: Privacy Policy.
© 2012-2014 All Rights Reserved.