Difference between revisions of "CentOS 8.x phpMyAdmin"

From Notes_Wiki
m
m
 
Line 33: Line 33:
#:: chmod 777 /usr/share/phpmyadmin/tmp
#:: chmod 777 /usr/share/phpmyadmin/tmp
#:</pre>
#:</pre>
# Create '<tt>/etc/httpd/conf.d/phpmyadmin.conf</tt>' with
# Create '<tt>/etc/httpd/conf.d/phpmyadmin.conf</tt>' with <source type="conf">
#:<pre>
Alias /phpmyadmin /usr/share/phpmyadmin
#::  Alias /phpmyadmin /usr/share/phpmyadmin
#::
<Directory /usr/share/phpmyadmin/>
#:: <Directory /usr/share/phpmyadmin/>
    AddDefaultCharset UTF-8
#::    AddDefaultCharset UTF-8
#::
    <IfModule mod_authz_core.c>
#::    <IfModule mod_authz_core.c>
      # Apache 2.4   
#::      # Apache 2.4   
      <RequireAny>
#::      <RequireAny>
      Require all granted
#::      Require all granted
      </RequireAny>
#::      </RequireAny>
    </IfModule>
#::    </IfModule>
    <IfModule !mod_authz_core.c>
#::    <IfModule !mod_authz_core.c>
      # Apache 2.2
#::      # Apache 2.2
      Order Deny,Allow
#::      Order Deny,Allow
      Deny from All
#::      Deny from All
      Allow from 127.0.0.1
#::      Allow from 127.0.0.1
      Allow from ::1
#::      Allow from ::1
     </IfModule>
#::     </IfModule>
</Directory>
#:: </Directory>
   
#::   
<Directory /usr/share/phpmyadmin/setup/>
#:: <Directory /usr/share/phpmyadmin/setup/>
    <IfModule mod_authz_core.c>
#::    <IfModule mod_authz_core.c>
      # Apache 2.4
#::      # Apache 2.4
      <RequireAny>
#::      <RequireAny>
        Require all granted
#::        Require all granted
      </RequireAny>
#::      </RequireAny>
    </IfModule>
#::    </IfModule>
    <IfModule !mod_authz_core.c>
#::    <IfModule !mod_authz_core.c>
      # Apache 2.2
#::      # Apache 2.2
      Order Deny,Allow
#::      Order Deny,Allow
      Deny from All
#::      Deny from All
      Allow from 127.0.0.1
#::      Allow from 127.0.0.1
      Allow from ::1
#::      Allow from ::1
    </IfModule>
#::    </IfModule>
</Directory>
#:: </Directory>
</source>
#:</pre>
# Start and enable httpd
# Start and enable httpd
#:<pre>
#:<pre>

Latest revision as of 04:18, 22 May 2023

Home > CentOS > CentOS 8.x > Web based tools > CentOS 8.x phpMyAdmin

To setup phpMyAdmin use:

  1. Install required packages
    dnf -y install wget epel-release php httpd tar php-mysqlnd expect php-json php-xml
  2. Download latest version of phpMyAdmin from https://www.phpmyadmin.net/downloads/ For Example
    wget https://files.phpmyadmin.net/phpMyAdmin/5.1.0/phpMyAdmin-5.1.0-english.tar.gz
  3. Extract the downloaded archive using tar. For example:
    tar xzf phpMyAdmin-5.1.0-english.tar.gz
  4. Move extracted folder to /usr/share/phpmyadmin location. For example
    mv phpMyAdmin-5.1.0-english /usr/share/phpmyadmin
  5. Go to /usr/share/phpmyadmin and rename config file.
    cd /usr/share/phpmyadmin
    mv config.sample.inc.php config.inc.php
  6. Edit config.inc.php file and insert 32 byte random secret for '$cfg['blowfish_secret']'. For example 'mkpasswd -l 32 -s 0'
    $cfg[‘blowfish_secret’]=’brsfgegjvxwRCoeeencssmmsq1athw7n’;
  7. Create temporary folder and set appropriate permissions
    mkdir /usr/share/phpmyadmin/tmp
    chown -R apache:apache /usr/share/phpmyadmin
    chmod 777 /usr/share/phpmyadmin/tmp
  8. Create '/etc/httpd/conf.d/phpmyadmin.conf' with
    Alias /phpmyadmin /usr/share/phpmyadmin
     
    <Directory /usr/share/phpmyadmin/>
        AddDefaultCharset UTF-8
     
        <IfModule mod_authz_core.c>
          # Apache 2.4  
          <RequireAny>
           Require all granted
          </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 all granted
          </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>
  9. Start and enable httpd
    systemctl start httpd
    systemctl enable httpd
  10. Optionally configure SELinux, Firewall and restrict access to phpMyAdmin to some IPs/via password


Refer:


Home > CentOS > CentOS 8.x > Web based tools > CentOS 8.x phpMyAdmin