phpMyAdmin

install phpmyadmin on centos 7

Prerequisite – LAMP server

Before starting phpmyadmin installation, You must setup LAMP server on your centos 7 server. Copy and paste below command in terminal for quick setup . At the end, you need to provide some inputs .

» leave blank for current mysql password.

» provide new password and press enter for the rest.

yum -y install httpd mariadb-server mariadb php php-mysql php-gd php-pear php-mbstring && systemctl start httpd.service && systemctl enable httpd.service && systemctl start mariadb && systemctl enable mariadb && firewall-cmd --permanent --add-service http && systemctl restart firewalld.service && mysql_secure_installation

You can also refer this guide – Install LAMP server on centos 7 for more detailed setup.

Install phpmyadmin on centos 7

By default, centos 7 repository does not contains phpmyadmin package. we need to enable EPEL repository. Find the latest EPEL for centos 7 from EPEL for Centos 7

Step 1 » Download and install epel-release-7-x.noarch.rpm file . or install directly by copying the rpm link.

[root@krizna ~]# rpm -ivh http://epel.mirror.net.in/epel/7/x86_64/e/epel-release-7-1.noarch.rpm

Step 2 » Update repositories by issuing below command .

[root@krizna ~]# yum check-update

Step 3 » Now install phpmyadmin package along with dependencies.

[root@krizna ~]# yum -y install phpmyadmin

Step 4 » After installation, Open /etc/httpd/conf.d/phpMyAdmin.conf file ( Apache config file for phpmyadmin ) and edit as follows.

Find these lines . ( Found 2 times )

1

2

3

4

5

# Apache 2.4

     <RequireAny>

      # Require ip 127.0.0.1

      # Require ip ::1

Require all granted

     </RequireAny>

Replace with

1

2

3

4

5

6

# Apache 2.4

    <RequireAny>

      # Require ip 127.0.0.1

      # Require ip ::1

      Require all granted

    </RequireAny>

Step 5 » Restart Apache service .

[root@krizna ~]# systemctl restart httpd.service

Step 6 » Now open http://serverIP/phpmyadmin in your browser. You can login using root as username and mysql root password.

CentOS--6

Installing Apache MySQL PHP on CentOS and RedHat

Step 1: Enable Remi Repository

phpMyAdmin most updated package is available under remi repository. Install it in your system using following commands.

CentOS/RHEL 7: # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm  CentOS/RHEL 6: # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm  CentOS/RHEL 5: # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.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  Fedora 18: # rpm -Uvh http://rpms.famillecollet.com/remi-release-18.rpm 

Step 2: Install phpMyAdmin

After adding remi repository, install phpMyAdmin using yum package manager. All the dependencies will automatically be installed.

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

Step 3: Configure phpMyAdmin

phpMyAdmin by default allowed to access from localhost only. If you want to make it accessible from remote computers edit vi /etc/httpd/conf.d/phpMyAdmin.conf and update all 127.0.0.1 with your network like below or enable phpMyAdmin access for everyone.

Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin  ## Comment below section to allow everyone <Directory /usr/share/phpMyAdmin/>     <IfModule !mod_authz_core.c>      Order Deny,Allow      Deny from All      Allow from 192.168.1.0/24      Allow from ::1    </IfModule> </Directory>  <Directory /usr/share/phpMyAdmin/libraries/>     Order Deny,Allow     Deny from All     Allow from None </Directory>  <Directory /usr/share/phpMyAdmin/setup/lib/>     Order Deny,Allow     Deny from All     Allow from None </Directory>  <Directory /usr/share/phpMyAdmin/setup/frames/>     Order Deny,Allow     Deny from All     Allow from None </Directory>

After updating phpMyAdmin Apache configuration file, restart Apache service to reload new settings.

# service httpd restart

Step 4: Access phpMyAdmin in Browser

Now you can access phpMyAdmin in browser using following url. Change svr1.tecadmin.net with your server IP/FQDN.

http://svr1.tecadmin.net/phpMyAdmin/  Login Details: Use MySQL username and password.

Congratulation’s You have successfully installed phpMyAdmin. Using single phpMyAdmin we can manage multiple MySQL servers by adding multiple remote MySQL server. Use this article to add multiple MySQL hosts in phpMyAdmin.

###########################

Install PHP

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely used open-source general purpose scripting language that is especially suited for web development and can be embedded into HTML.

Install PHP with following command:

# yum install php -y

Test PHP

Create a sample “testphp.php” file in Apache document root folder and append the lines as shown below:

# vi /var/www/html/testphp.php

Add the following lines.

Restart httpd service:

# service httpd restart

Navigate to http://server-ip-address/testphp.php. It will display all the details about php such as version, build date and commands etc.

If you wanna to get MySQL support in your PHP, you should install “php-mysql” package. If you want to install all php modules just you use the command “yum install php*”

[root@server ~]# yum install php-mysql -y

Now open the phptest.php file in your browser using http://ip-address/testphp.php or http://domain-name/testphp.php. Scroll down and you will see the mysql module will be presented there.

Install phpMyAdmin

phpMyAdmin is a free open source web interface tool, used to manage your MySQL databases. By default phpMyAdmin is not found in CentOS official repositories. So let us install it using EPEL repository.

To install EPEL repository, follow the below link:

Install EPEL Repository On RHEL/CentOS/Scientific Linux 6

Now install phpMyAdmin

# yum install phpmyadmin -y

Configure phpMyAdmin

Edit the phpmyadmin.conf file.

# vi /etc/httpd/conf.d/phpMyAdmin.conf

Find and comment the whole /<Directory> section as shown below:

[...] Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin  #<Directory /usr/share/phpMyAdmin/>#   <IfModule mod_authz_core.c>#     # Apache 2.4#     Require local#   </IfModule>#   <IfModule !mod_authz_core.c>#     # Apache 2.2#     Order Deny,Allow#     Deny from All#     Allow from 127.0.0.1#     Allow from ::1#   </IfModule>#</Directory> [...]

Open “config.inc.php” file and change from “cookie” to “http” to change the authentication in phpMyAdmin:

# cp /usr/share/phpMyAdmin/config.sample.inc.php /usr/share/phpMyAdmin/config.inc.php

# cp /usr/share/doc/phpMyAdmin-4.4.15.10/examples/config.sample.inc.php /etc/phpMyAdmin/config.inc.php

vi /etc/phpMyAdmin/config.inc.php

# vi /usr/share/phpMyAdmin/config.inc.php

Change cookie to http.

[...]  /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'http'; [...]

Restart the Apache service:

# service httpd restart

Now you can access the phpmyadmin console by navigating to http://server-ip-address/phpmyadmin/ from your browser.

Enter your MySQL username and password which you have given in previous steps. In my case its “root” and “centos”.

Now you will be redirected to the phpmyadmin dashboard.page as shown below.

Now you will able to manage your MariaDB databases from phpMyAdmin web interface.

----