尝试打开 phpmyadmin 时出现错误 403。我该怎么做才能纠正它?
Posted
技术标签:
【中文标题】尝试打开 phpmyadmin 时出现错误 403。我该怎么做才能纠正它?【英文标题】:Error 403 as I try to open phpmyadmin. What do I do to correct it? 【发布时间】:2013-03-02 16:00:31 【问题描述】:当我尝试打开 localhost/phpmyadmin/
时,我收到以下错误:
Access forbidden!
New XAMPP security concept:
Access to the requested directory is only available from the local network.
This setting can be configured in the file "httpd-xampp.conf".
If you think this is a server error, please contact the webmaster.
Error 403
这是为什么呢?我打开了httpd-xampp.conf
文件,但我不知道该怎么做。
这是完整的httpd-xampp.conf
文件:
<IfDefine PHP4>
LoadModule php4_module modules/libphp4.so
</IfDefine>
<IfDefine PHP5>
LoadModule php5_module modules/libphp5.so
</IfDefine>
# Disabled in XAMPP 1.8.0-beta2 because of current incompatibilities with Apache 2.4
# LoadModule perl_module modules/mod_perl.so
Alias /phpmyadmin "/opt/lampp/phpmyadmin"
Alias /phpsqliteadmin "/opt/lampp/phpsqliteadmin"
# since XAMPP 1.4.3
<Directory "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
Order allow,deny
Allow from all
</Directory>
<Directory "/opt/lampp/phpsqliteadmin">
AllowOverride AuthConfig Limit
Order allow,deny
Allow from all
</Directory>
# since LAMPP 1.0RC1
AddType application/x-httpd-php .php .php3 .php4
XBitHack on
# since 0.9.8 we've mod_perl
<IfModule mod_perl.c>
AddHandler perl-script .pl
PerlHandler ModPerl::PerlRunPrefork
PerlOptions +ParseHeaders
PerlSendHeader On
</IfModule>
# demo for mod_perl responsehandler
#PerlModule Apache::CurrentTime
#<Location /time>
# SetHandler modperl
# PerlResponseHandler Apache::CurrentTime
#</Location>
# AcceptMutex sysvsem is default but on some systems we need this
# thanks to jeff ort for this hint
#AcceptMutex flock
#LockFile /opt/lampp/logs/accept.lock
# this makes mod_dbd happy - oswald, 02aug06
# mod_dbd doesn't work in Apache 2.2.3: getting always heaps of "glibc detected *** corrupted double-linked list" on shutdown - oswald, 10sep06
#DBDriver sqlite3
#
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
Deny from all
Allow from ::1 127.0.0.0/8 \
fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
fe80::/10 169.254.0.0/16
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
【问题讨论】:
从这里尝试解决方案:***.com/questions/11630412/phpmyadmin-xampp-error 【参考方案1】:看起来这部分是你的问题,你的 IP 地址/IP 范围不能在允许的 IP 列表中
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
Deny from all
# The line below this comment!
Allow from ::1 127.0.0.0/8 \
fc00::/7 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 \
fe80::/10 169.254.0.0/16
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
如果这是一个开发环境,那么以下就足够了:
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
Order deny,allow
Allow from all
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
否则,只需将您的 IP 范围添加到允许的部分:)
编辑:我应该把 cmets 的答案放在这里,以便人们更容易看到:
"好吧,试试在Allow后面加上Require all grant就行了 从该部分的所有行中。”
【讨论】:
当我删除你提到的部分时,我什至无法访问localhost
页面!
你能告诉我你到底放了什么吗?当您尝试访问它时会发生什么?
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))"> Order deny,allow Allow from all ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var </LocationMatch>
和你说的一样!
我收到了和之前一样的信息以上是关于尝试打开 phpmyadmin 时出现错误 403。我该怎么做才能纠正它?的主要内容,如果未能解决你的问题,请参考以下文章