php XAMPP - 只能从本地网络访问所请求的对象
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/43614783/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
XAMPP - Access to the requested object is only available from the local network
提问by Ignas Damunskis
When I try to access an phpMyAdmin of xampp in another pc using ip address I get this error:
当我尝试使用 ip 地址在另一台电脑上访问 xampp 的 phpMyAdmin 时,我收到此错误:
Access forbidden!
New XAMPP security concept:
Access to the requested object is only available from the local network.
This setting can be configured in the file "httpd-xampp.conf".
禁止访问!
新的 XAMPP 安全概念:
只能从本地网络访问所请求的对象。
此设置可以在文件“httpd-xampp.conf”中配置。
I was searching for the solution and found a bunch of suggestions like modifying httpd-xampp.conf
file.
我正在寻找解决方案并找到了一堆建议,例如修改httpd-xampp.conf
文件。
1) Option was to modify <LocationMatch>
block like this:
1)选项是<LocationMatch>
像这样修改块:
<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>
The problem is that my httpd-xampp.conf
file does not contain such a block, but if I try to add it to the end of the file I still get the same error.
问题是我的httpd-xampp.conf
文件不包含这样的块,但是如果我尝试将它添加到文件末尾,我仍然会遇到相同的错误。
2) Option was to modify <Directory "C:/xampp/phpMyAdmin">
as following:
2)选项是修改<Directory "C:/xampp/phpMyAdmin">
如下:
<Directory "C:/xampp/phpMyAdmin">
AllowOverride AuthConfig Limit
Order allow,deny
Allow from all
Require all granted
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
Or
或者
<Directory "C:/xampp/phpMyAdmin">
AllowOverride AuthConfig Limit
Order allow,deny
Allow from all
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
Or
或者
<Directory "C:/xampp/phpMyAdmin">
AllowOverride AuthConfig Limit
Require all granted
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
This didn't solve the problem either. Still getting same error.
这也没有解决问题。仍然得到同样的错误。
P.S. I am restarting Apache after each change!
PS每次更改后我都重新启动Apache!
Could someone see what I could be missing?
有人能看到我可能缺少什么吗?
回答by Yi Hsuan Wang
I just fixed it ! Please go to :
我刚修好!请前往:
<Directory "C:/xampp/phpMyAdmin">
AllowOverride AuthConfig
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
and change all the contents as below:
并将所有内容更改如下:
<Directory "C:/xampp/phpMyAdmin">
AllowOverride AuthConfig Limit
Order allow,deny
Require all granted
Allow from all
</Directory>
回答by Seishin Okigaru
If you using Mac, Go to Xampp Panel > Volumes > Mount, and here you are
如果您使用 Mac,请转到 Xampp 面板 > 卷 > 挂载,您就在这里
then,
然后,
open httpd-xampp.conf
change:
打开 httpd-xampp.conf
改变:
<Directory "/opt/lampp/phpmyadmin"> AllowOverride AuthConfig Limit Require local ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var </Directory>
<Directory "/opt/lampp/phpmyadmin"> AllowOverride AuthConfig Limit Require local ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var </Directory>
to:
到:
<Directory "/opt/lampp/phpmyadmin"> AllowOverride AuthConfig Limit Order allow,deny Allow from all Require all granted </Directory>
<Directory "/opt/lampp/phpmyadmin"> AllowOverride AuthConfig Limit Order allow,deny Allow from all Require all granted </Directory>
5) Restart Services
5) 重启服务
回答by Mubashar
Nothing worked for me but following thing was awesome:
没有什么对我有用,但以下事情很棒:
1)Open
1)打开
/opt/lampp/etc/extra/httpd-xampp.conf
/opt/lampp/etc/extra/httpd-xampp.conf
2)Find <Directory "/opt/lampp/phpmyadmin">
2)查找<Directory "/opt/lampp/phpmyadmin">
3)Now just add Require all granted before
3)现在只需添加 Require all grant before
4)So the code will look like this
4)所以代码看起来像这样
<Directory "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
Order allow,deny
Allow from all
Require all granted
</Directory>
5)Now finally Restart XAMPP
5)现在终于重新启动XAMPP
回答by Nizar
I found a solution
我找到了解决方案
just comment this line "Require local"
只需评论这一行“需要本地”
# since XAMPP 1.4.3
<Directory "/opt/lampp/phpmyadmin">
AllowOverride AuthConfig Limit
#Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>