Forbidden :You don't have permission to access /phpmyadmin on this server

前端 未结 11 1420
死守一世寂寞
死守一世寂寞 2020-12-07 09:09

Hi I have installed phpmyadmin on my centos machine and when I try to hit phpmyadmin through my browser I get this error :

Forbidden
You don\'t          


        
相关标签:
11条回答
  • 2020-12-07 09:48

    First edit the file /etc/httpd/conf.d/phpMyAdmin.conf and add the additional line to the directory settings:

    <Directory /usr/share/phpMyAdmin/>
    order deny,allow
    deny from all
    allow from 127.0.0.1
    allow from 192.168.1.0/15
    </Directory>
    

    If you wanted to allow access to everybody then you could just change it to:

    <Directory /usr/share/phpMyAdmin/>
    order allow,deny
    allow from all
    </Directory>
    

    Allow in all sections of the file.

    A restart (service httpd restart) is enough to pick this up.

    I found this after 2 days rigorous research, (find it here) and worked just right for me.

    0 讨论(0)
  • 2020-12-07 09:51

    Edit file: sudo nano /etc/httpd/conf.d/phpMyAdmin.conf and replace yours with following:

    <Directory /usr/share/phpMyAdmin/>
       AddDefaultCharset UTF-8
       <IfModule mod_authz_core.c>
         # Apache 2.4
       </IfModule>
       <IfModule !mod_authz_core.c>
         # Apache 2.2
       </IfModule>
    </Directory>
    

    Restart Apache: service httpd restart

    (phpMyAdmin v4.0.10.8)

    0 讨论(0)
  • 2020-12-07 09:54

    On a fresh install on CENTOS7 I have tried the above methods (edit phpMyAdmin.conf and add Require all granted), it still does'nt work. Here is the solution : install the mod_php module :

    $ sudo yum install php
    

    then restart httpd :

    $ sudo systemctl restart httpd
    

    and voila !

    0 讨论(0)
  • 2020-12-07 09:59

    You could simply go to phpmyadmin.conf file and change "deny from all" to "allow from all". Well it worked for me, hope it works for you as well.

    0 讨论(0)
  • 2020-12-07 10:00

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

    Edit file phpMyAdmin.conf

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

    And replace the existing <Directory> ... </Directory> node with the following:

    <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)
  • 2020-12-07 10:00

    Centos 7 php install comes with the ModSecurity package installed and enabled which prevents web access to phpMyAdmin. At the end of phpMyAdmin.conf, you should find

    # This configuration prevents mod_security at phpMyAdmin directories from
    # filtering SQL etc.  This may break your mod_security implementation.
    #
    #<IfModule mod_security.c>
    #    <Directory /usr/share/phpMyAdmin/>
    #        SecRuleInheritance Off
    #    </Directory>
    #</IfModule>
    

    which gives you the answer to the problem. By adding

        SecRuleEngine Off
    

    in the block "Directory /usr/share/phpMyAdmin/", you can solve the 'denied access' to phpmyadmin, but you may create security issues.

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