You don't have permission to access /phpMyAdmin/ on this server.

Issues related to software problems.
Locked
ddjjmm
Posts: 9
Joined: 2011/12/06 14:40:14

You don't have permission to access /phpMyAdmin/ on this server.

Post by ddjjmm » 2012/01/26 08:12:55

Hello all,

I'm getting the following error message while trying to access http://servername.com/phpMyAdmin/. I'm running CentOS 5.7 with 5.3.8, MySQL 5.5.18.
[code]You don't have permission to access /phpMyAdmin/ on this server.[/code]

My /etc/httpd/conf.d/phpMyAdmin.conf looks like:
[code]
# 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/>
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from all
</Directory>

# This directory does 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/frames>
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>

# 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>
[/code]
Any ideas how to solve this problem? There aren't any phpmyadmin files in /var/www/ directory at the moment.

I think it could have to be a problem with the first setting which could deny an access of my conf file but I'm not sure:

[code]
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from all
</Directory>
[/code]

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

You don't have permission to access /phpMyAdmin/ on this ser

Post by pschaff » 2012/01/26 19:54:24

You could try temporarily changing SELinux to permissive mode with "setenforce 0" and see if that helps. If so the AVC denials should give a clue as to how to fix it permenently.

You are not using the standard MySQL, and apparently php, packages, so it may be hard to get support here. If more help is needed then please [url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=28723&forum=54]provide more information about your system[/url] by running "./getinfo.sh package" and showing us the output file, along with
[code]rpm -qa php\* mysql\* | sort[/code]

milosb
Posts: 661
Joined: 2009/01/18 00:39:15
Location: 44 49&#8242;14&#8243;N 20 27&#8242;44&#8243;E

Re: You don't have permission to access /phpMyAdmin/ on this server.

Post by milosb » 2012/01/29 22:15:16

[quote]
pschaff wrote:
You could try temporarily changing SELinux to permissive mode with "setenforce 0" and see if that helps. If so the AVC denials should give a clue as to how to fix it permenently.[/quote]
Indeed he could and should, however, I never witnessed SELinux causing problems with PHPMyAdmin... Instead, I believe this is the culprit:

[code]
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
Order Deny,Allow
Deny from All
[b] Allow from 127.0.0.1
Allow from all[/b]
</Directory>
[/code]
First of all, there's no need to have two [b]Allow from[/b] lines - not even sure if the second will be referenced... I've experienced some oddities in the past while working with this kind of access control.

So, I recommend you comment the second line, and append the IP address, subnet, or the domain your accessing from to the first [b]Allow from[/b] line. Both comma separated and space separated should work.
After that, all you need to do is reload the Apache config.

ddjjmm
Posts: 9
Joined: 2011/12/06 14:40:14

Re: You don't have permission to access /phpMyAdmin/ on this server.

Post by ddjjmm » 2012/01/30 07:59:07

Thanks for your reply.

I changed the .conf into the following and restartet httpd service:

[code]Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
Order Deny,Allow
Deny from All
</Directory>[/code]

but same problem...

DaemonProgrammr
Posts: 78
Joined: 2011/12/12 12:49:46

Re: You don't have permission to access /phpMyAdmin/ on this server.

Post by DaemonProgrammr » 2012/01/30 09:23:39

I'm not a httpd.conf expert.. But doesn't this definition basically mean:
"Deny any and all requests to this alias, no matter where they're coming from"?

Personally I'd say 'remove the Deny from all line' because by default "Order Deny, Allow" should already do that.
Then below that, add 'Allow from 127.0.0.1'. (If you're accessing from localhost) to tell httpd that although by default
all requests should be denied, 127.0.0.1 whould be allowed.

(Don't forget to reboot the server again)

Recheck. :)

Let us know what happened.

ddjjmm
Posts: 9
Joined: 2011/12/06 14:40:14

Re: You don't have permission to access /phpMyAdmin/ on this server.

Post by ddjjmm » 2012/01/30 13:43:18

[code]
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
Order Deny,Allow
Allow from 127.0.0.1
Allow from all
</Directory>
[/code]

Hope I understand you the right way and changed the conf like above but no effect.

User avatar
TrevorH
Forum Moderator
Posts: 23652
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: You don't have permission to access /phpMyAdmin/ on this server.

Post by TrevorH » 2012/01/30 14:15:48

Look in your httpd error logs in /var/log/httpd for more clues about the problem.

BTW, you can have more than one allow line as it's fairly standard practice to give access that way to, e.g., multiple subnets. More readable that way than splatting them all on a single allow line.

milosb
Posts: 661
Joined: 2009/01/18 00:39:15
Location: 44 49&#8242;14&#8243;N 20 27&#8242;44&#8243;E

Re: You don't have permission to access /phpMyAdmin/ on this server.

Post by milosb » 2012/01/30 22:27:37

[quote]
ddjjmm wrote:
Thanks for your reply.

I changed the .conf into the following and restartet httpd service:

[code]Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
Order Deny,Allow
Deny from All
</Directory>[/code]

but same problem...[/quote]
I really don't recall saying you're supposed to remote both [b]Allow from[/b] lines... just the second one - and amend the first one according to your needs.

[quote]
TrevorH wrote:

Look in your httpd error logs in /var/log/httpd for more clues about the problem.

BTW, you can have more than one allow line as it's fairly standard practice to give access that way to, e.g., multiple subnets. More readable that way than splatting them all on a single allow line.
[/quote]
Apparently, there's no need to remove either of the lines... and you should definitely follow [b]Trevor's[/b] advice to make sure this access control mechanism is the culprit.

maibamsharat
Posts: 6
Joined: 2013/12/03 00:57:17

Re: You don't have permission to access /phpMyAdmin/ on this server.

Post by maibamsharat » 2016/09/19 19:34:04

If you've done all that permission settings, then try simple things like putting the url with index.php
(like, http://your-address/phpmyadmin/index.php)...sometime the default landing page index.php is not detected by your webserver if the setting is not done correctly.

Locked