Reputation: 960
I'm aware this has been asked many times before but all of the answers seem the same and none of them work for me.
I want to access the phpmyadmin GUI from something other than the localhost.
I'm getting the error "Forbidden - You don't have permission to access /phpmyadmin/ on this server." in the browser.
I'm using CentOS7, Apache 2.4.6 and phpMyAdmin-4.4.15.10-1.el7.
I've tried this:
<Directory /usr/share/phpMyAdmin/>
Order Allow,deny
Allow from all
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
Order Allow,deny
Allow from all
</Directory>
Most people seem to suggest I can just do:
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require all granted
</RequireAny>
</IfModule>
Or:
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 192.168.1.6
</RequireAny>
</IfModule>
But none of that works.
This is the current state:
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 192.168.1.6
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Allow,Deny
Allow from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
Still getting:
Forbidden
You don't have permission to access /phpmyadmin/ on this server.
EDIT-
Just as additional information, I have disabled SELinux and made sure permissions on /usr/share/phpMyAdmin are correct.
EDIT AGAIN-
I've now tried this...
<Directory /usr/share/phpMyAdmin/>
Require all granted
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
Require all granted
</Directory>
Which is surely as basic as you can get and yet I still get the error?
Upvotes: 1
Views: 31907
Reputation: 281
<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 Allow,Deny
Allow from All
</IfModule>
</Directory>
Upvotes: 3
Reputation: 960
Got this working eventually. There were a few problems at once, which was getting in the way of troubleshooting the main problem...
First, edit phpMyAdmin.conf...
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 192.168.1.6
</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>
OR
<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>
You also need to make sure that/usr/share/phpMyAdmin is not only readable but also executable for the Apache user. I just recursively chmodded it to 777.
You also need to add the following to /etc/httpd/conf/httpd.conf:
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
Check /var/log/httpd/error_log to see what your particular error is at each step.
Upvotes: 1