phpMyAdmin + CentOS 6.0 - Forbidden

后端 未结 4 1103
温柔的废话
温柔的废话 2021-02-12 10:29

I always get this message when I would like access my phpMyAdmin.

w3m localhost/phpmyadmin

Forbidden

You don\'t have permission to access /phpmyadmin/ on this          


        
相关标签:
4条回答
  • 2021-02-12 10:46

    Edit your httpd.conf file as follows:

    # nano /etc/httpd/conf/httpd.conf
    

    Add the following lines here:

    <Directory "/usr/share/phpmyadmin">
        Order allow,deny
        Allow from all
    </Directory>
    

    Issue the following command:

    # service httpd restart
    

    If your problem is not solved then disable your SELinux.

    0 讨论(0)
  • 2021-02-12 10:49

    None of the configuration above worked for me on my CentOS 7 server. After hours of searching, that's what worked for me:

    Edit file phpMyAdmin.conf

    sudo nano /etc/httpd/conf.d/phpMyAdmin.conf

    And replace this at the top:

    <Directory /usr/share/phpMyAdmin/>
       AddDefaultCharset UTF-8
    
       <IfModule mod_authz_core.c>
         # Apache 2.4
         <RequireAny>
           #Require ip 127.0.0.1
           #Require ip ::1
           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>
    
    0 讨论(0)
  • 2021-02-12 10:52

    I had the same issue for two days now. Disabled SELinux and everything but nothing helped. And I realize it just may not be smart to disable security for a small fix. Then I came upon this article - http://wiki.centos.org/HowTos/SELinux/ that explains how SELinux operates. So this is what I did and it fixed my problem.

    1. Enable access to your main phpmyadmin directory by going to parent directory of phpmyadmin (mine was html) and typing:

      chcon -v --type=httpd_sys_content_t phpmyadmin
      
    2. Now do the same for the index.php by typing:

      chcon -v --type=httpd_sys_content_t phpmyadmin/index.php
      

      Now go back and check if you are getting a blank page. If you are, then you are on the right track. If not, go back and check your httpd.config directory settings. Once you do get the blank page with no warnings, proceed.

    3. Now recurse through all the files in your phpmyadmin directory by running:

      chron -Rv --type=httpd_sys_content_t phpmyadmin/*
      

    Go back to your phpmyadmin page and see if you are seeing what you need. If you are running a web server that's accessible from outside your network, make sure that you reset your SELinux to the proper security level. Hope this helps!

    0 讨论(0)
  • 2021-02-12 10:59

    I tried all answers provided here: editing phpMyAdmin.conf, changing selinux context for phpmyadmin folder, disabling selinux... but I still got a 'Forbidden' from the web server.

    I finally found what I was missing in Edouard Thiel post here :

    $ yum install php

    then restart httpd :

    $ service httpd restart => for centos 6 hots

    $ systemctl restart httpd => for centos 7 hosts

    What has me amazed is why php is not installed as dependency for phpmyadmin in the first place.

    Regards, Fred

    0 讨论(0)
提交回复
热议问题