Sunday, July 11, 2021

,

Install older version of PhpMyAdmin on Centos7 manually

This is a short guide on how to install PhpMyAdmin manually on CentOS 7 server. For that download the required version of PhpMyAdmin from the following link

https://www.phpmyadmin.net/downloads/

Lets download and start with the installation process: 

Step 1: Go to /usr/share directory

[root@localhost ~]# cd /usr/share

Step 2: Download required phpMyAdmin package using the command:  In this case v.4.4.5.

[root@localhost share]# wget https://files.phpmyadmin.net/phpMyAdmin/4.4.5/phpMyAdmin-4.7.0-all-languages.zip

 Step 3: Unzip the file using the following command:

[root@localhost share]# unzip phpMyAdmin-4.4.5-all-languages.zip

 If the unzip command does not work, means you will have to install the unzip package on your CentOS 7 Server. For that execute the following command:

[root@localhost share]# yum install unzip

Step 4: Rename the extracted folder using the command:

[root@localhost share]# mv phpMyAdmin-4.4.5-all-languages phpmyadmin

Step 5: Create tmp directory and set the proper permissions

1.

[root@localhost share]# mkdir /usr/share/phpmyadmin/tmp

2.

[root@localhost share]# chown -R apache:apache /usr/share/phpmyadmin

3.

[root@localhost share]# chmod 777 /usr/share/phpmyadmin/tmp

Step 6: Create apache configuration file in /etc/httpd/conf.d  directory in the name of phpmyadmin.conf using vi editor.

[root@localhost share]# vi /etc/httpd/conf.d/phpmyadmin.conf

And paste the following configuration settings on it :

Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /phpmyadmin /usr/share/phpmyadmin
 
<Directory /usr/share/phpmyadmin/>
    AddDefaultCharset UTF-8
 
    <IfModule mod_authz_core.c>
      # Apache 2.4
      <RequireAny>
        Require all granted
        Require ip 127.0.0.1
        Require ip ::1
      </RequireAny>
    </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>
 
<Directory /usr/share/phpmyadmin/setup/>
    <IfModule mod_authz_core.c>
      # Apache 2.4
      <RequireAny>
        Require ip 127.0.0.1
        Require ip ::1
      </RequireAny>
    </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>
 
# These directories do not require access over HTTP - taken from the original
# phpmyadmin upstream tarball
#
<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>
 

 Save the file using :wq command 

 Step 7: SELinux policies

 The systems with SELinux enabled needs to set proper permissions to allow SELinux policies

[root@localhost share]# chcon -Rv --type=httpd_sys_content_t /usr/share/phpmyadmin/*

 After making all the changes, make sure to start the Apache service to reload all settings using the command :

[root@localhost share]# systemctl restart httpd 

To test open Firefox web browser and type http://localhost/phpmyadmin . You should see the  PhpMyAdmin login page. 

If you get error: phpMyAdmin  - Error : The mbstring extension is missing: Execute command

[root@localhost share]# yum install php-mbstring 

 If you get error: phpMyAdmin  - Error : The mysqli | mysql extension is missing: Execute command

[root@localhost share]# yum install php-mysqli

Finally restart httpd service

[root@localhost share]# systemctl restart httpd
Share:

0 comments:

Post a Comment