Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 have permission to access `phpmyadmin` on this server. 

My phpmyadmin.conf file has following content:

# phpMyAdmin - Web based MySQL browser written in php #  # Allows only localhost by default # # But allowing phpMyAdmin to anyone other than localhost should be considered # dangerous unless properly secured by SSL  Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin   <Directory /usr/share/phpMyAdmin/>    <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>  <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>  # 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> 

Kindly help me resolve this issue. Any lead is appreciated.

Thanks

like image 269
Megha Sharma Avatar asked Apr 23 '14 05:04

Megha Sharma


People also ask

How do you fix you don't have permission to access phpMyAdmin on this server?

Change the file content of c:\wamp\alias\phpmyadmin. conf to the following. You should remember to set the Allow Directive to allow it from your local machine for security purposes. The directive Allow from all is insecure and should be limited to your local machine.

How do I give permission to WAMP server?

Choose the file httpd. conf. Under the Directory tab section (section with "# Online --> Require all granted" text), I had the "Require local" option which I changed to "Require all granted" Restart all services of the WAMP.


2 Answers

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> 
like image 141
Hyder B. Avatar answered Sep 18 '22 12:09

Hyder B.


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 !

like image 42
Edouard Thiel Avatar answered Sep 21 '22 12:09

Edouard Thiel