Skip to main content

How to install phpmyadmin on nginx on centos 6

Phpmyadmin is a free tool used to administrate MySQL . it supports all major operation with MySQL in GUI mode.
In the previous post we saw about installing and configuring nginx on centos 6.5 . Here we can see about installing phpmyadmin on nginx server.
Before starting please make sure you have installed LEMP stack ( Nginx , mysql and php )
Refer this post (Install LEMP on centos 6)

Install phpmyadmin on nginx on centos 6.5

Step 1 » Enable EPEL repository for installing dependencies . Find the latest release file from EPEL 6 repository and install using rpm command.
[root@krizna ~]# rpm -ivh http://epel.mirror.net.in/epel/6/i386/epel-release-6-8.noarch.rpm
Step 2 » Install dependencies by the below command.
[root@krizna ~]# yum install php php-cli php-gd php-mbstring php-mcrypt php-php-gettext apr-util-ldap mailcap
Step 3 » Download latest phpmyadmin from official site ( Phpmyadmin Download ) to /usr/share/ directory. choose .tar.bz2 for less size and easy extraction with default tar command.
[root@krizna ~]# cd /usr/share/
[root@krizna share]# wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.1.7/phpMyAdmin-4.1.7-all-languages.tar.bz2

Step 4 » Extract the files using the below command.
[root@krizna share]# tar -xvf phpMyAdmin-4.1.7-all-languages.tar.bz2
Step 5 » Rename the folder .
[root@krizna share]# mv phpMyAdmin-4.1.7-all-languages phpmyadmin
Step 6 » Create a config file inside phpmyadmin folder. just copy config.sample.inc.php into config.inc.php file .
[root@krizna phpmyadmin]# cp config.sample.inc.php config.inc.php
Step 7 » Create a virtual site to access phpmyadmin in 8080 port . Create a file /etc/nginx/conf.d/phpmyadmin.conf and add the below lines .

Step 8 » Restart nginx service.
[root@krizna ~]# service nginx restart
Open /etc/sysconfig/iptables file and add the following line to open port 8080 in iptables.
-A INPUT -m state --state NEW -p tcp --dport 8080 -j ACCEPT
Step 9 » Now open http://serverip:8080 in your browser . you could see phpmyadmin login page . use mysql root username and password to login . after logged in, you can see the page below.
phpmyadmin-on-nginx-on-centos
All the best.

  • Daniel

    I followed your instructions but it failed, it shows me the following error when I type localhost:8080 on my browser:Cannot start session without errors, please check errors given in your
    PHP and/or webserver log file and configure your PHP installation
    properly. Also ensure that cookies are enabled in your browser.

    • Jeroen

      Same thing here 🙁 On Stack Overflow they sayd that you have to flush your browser cache/cookies, but no luck. Also something with “session.save_path” in the /etc/php.ini file. Does anyone know how to fix this?

      • krizna

        try this

        chmod 0777 /var/lib/php/session

    • Charles Wells

      type in terminal:
      service iptables stop
      and try agen

  • Daniel

    I followed your instructions but it failed, it shows me the following error when I type localhost:8080 on my browser:Cannot start session without errors, please check errors given in your
    PHP and/or webserver log file and configure your PHP installation
    properly. Also ensure that cookies are enabled in your browser.

    • Jeroen

      Same thing here 🙁 On Stack Overflow they sayd that you have to flush your browser cache/cookies, but no luck. Also something with “session.save_path” in the /etc/php.ini file. Does anyone know how to fix this?

      • krizna

        try this

        chmod 0777 /var/lib/php/session

    • Charles Wells

      type in terminal:
      service iptables stop
      and try agen

  • Zeraphine

    how can i do to redirect login to a https?

  • Zeraphine

    how can i do to redirect login to a https?

  • Naurelijs

    Hey,

    Not working for me, blank (white) page ;/

    • Naurelijs

      Fixed by command “service php-fpm restart” 🙂

  • Naurelijs

    Hey,

    Not working for me, blank (white) page ;/

    • Naurelijs

      Fixed by command “service php-fpm restart” 🙂

  • Pingback: さくらのVPSにCent OS/ Nginx / Mysql / PHP の環境を構築 | 千葉県柏市のホームページ制作会社-株式会社Circle()

  • Pls help me
    it show The connection has timed out