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
First edit the file /etc/httpd/conf.d/phpMyAdmin.conf and add the additional line to the directory settings:
If you wanted to allow access to everybody then you could just change it to:
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.
The problem with the answer with the most votes is it doesn't explain the reasoning for the solution.
For the lines
Require ip 127.0.0.1
, you should instead add the ip address of the host that plans to access phpMyAdmin from a browser. For exampleRequire ip 192.168.0.100
. TheRequire ip 127.0.0.1
allows localhost access to phpMyAdmin.Restart apache (httpd) after making changes. I would suggest testing on localhost, or using command line tools like curl to very a http GET works, and there is no other configuration issue.
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.
You need to follow the following steps:
Find line that read follows
Replace with your workstation IP address:
Again find the following line:
Replace as follows:
Also find
deny from all
and comment it in the entire file.Save and close the file.
Restart Apache httpd server
:To allow from all:
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 this at the top: