Xampp:我无法从localhost访问phpMyAdmin

时间:2012-10-19 17:31:29

标签: ubuntu phpmyadmin xampp localhost

我正在尝试为家庭开发设置Xampp。它已正确安装,我可以访问xampp页面,如演示,安全性,状态...甚至使用phytin-gui来启动和停止服务器。

但是当使用“http://localhost/phpmyadmin”访问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".

我检查了我的httpd-xampp.conf并且似乎是正确的。我试图更改deny All for the Allow all但不起作用。

我的主机文件将localhost指向127.0.0.1,这是访问所有xampp文件的预期。

我在ubuntu 12.04机器上运行XAMPP 1.8.1

有同样问题的人吗?我在网上搜索了近2个小时,但我发现的所有内容都是在尝试从其他网络或机器访问服务器时发生此错误。但对我来说,情况是我直接在服务器上工作,所以我认为我可以默认访问phpMyAdmin。

我的httpd-xampp.conf

#
# 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>

4 个答案:

答案 0 :(得分:5)

如果您在/opt/lampp/etc/extra下安装了XAMPP,请转到/opt目录,然后修改httpd-xampp.conf以添加Require all granted,如下所示:

# since XAMPP 1.4.3
<Directory "/opt/lampp/phpmyadmin">
    AllowOverride AuthConfig Limit
    Order allow,deny
    Allow from all
    Require all granted
</Directory>

您可能需要运行/opt/lampp/lampp restart重新启动LAMPP服务器。

答案 1 :(得分:2)

我也在XAMPP自己的论坛中发现了这个问题。提到Require all granted答案,但无条件授予访问权限。该主题继续提供a better solution

  

只需更新您的httpd-xampp.conf即可。   将结束替换为:

#
# New XAMPP security concept
#
<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
    <RequireAny>
        Require ip ::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
    </RequireAny>
    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>
     

然后重新启动你的灯泡:       sudo / opt / lampp / lampp restart

参考:http://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#require

答案 2 :(得分:0)

我通过为phpmyadmin

创建新的虚拟主机来解决这个问题

将以下内容附加到C:/xampp/apache/conf/httpd.conf

NameVirtualHost phpmyadmin.local

<VirtualHost phpmyadmin.local>
  ServerName phpmyadmin.local
  DocumentRoot "C:/xampp/htdocs/phpmyadmin"
  <Directory "C:/xampp/htdocs/phpmyadmin">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

DocumentRoot/Directory更改为您安装phpmyadmin版本的路径。

在文本编辑器中打开C:\Windows\System32\drivers\etc\hosts文件并添加以下行:

127.0.0.1     phpmyadmin.local

然后保存hosts文件并重新启动xampp

https://stackoverflow.com/a/16617319/2395363

答案 3 :(得分:0)

这个答案适用于XAMPP 1.8.2 [PHP:5.4.25]

在下面的Require local之前放置#mark,重要的是,在xampp控制面板中停止并启动Apache。就是这样,它肯定有用

<LocationMatch "^/(?i:(?:xampp|security|licenses|phpmyadmin|webalizer|server-status|server-info))">
       #Require local

    ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</LocationMatch>