4
votes

I was trying to set up Xampp for home development. It's correctly installed and I can access xampp pages like demos, security, status... even using the phytin-gui to start and stop the server.

But when it comes to access phpMyAdmin using 'http://localhost/phpmyadmin' I get the next error:

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".

I checked my httpd-xampp.conf and seems to be correct. I tried to change the deny All for the Allow all but not worked.

My host files points localhost to 127.0.0.1, which is what is expected to access all xampp files.

I'm runing XAMPP 1.8.1 in ubuntu 12.04 machine

Someone that had that same issue? I lost near 2 hours googling but all what I found is that this error happens when trying to access the server from other network or machine. But for me the case is that i work directly on the server so its supposed that i could access phpMyAdmin as default.

My 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
look at my answer in this topic: stackoverflow.com/a/16617319/2395363Andy

4 Answers

6
votes

Go to /opt/lampp/etc/extra directory in case you have installed XAMPP under /opt, and edit httpd-xampp.conf to add Require all granted as shown below:

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

You may have to restart your LAMPP sever by running /opt/lampp/lampp restart.

2
votes

I also found this problem in XAMPP's own forum. The Require all granted answer is mentioned, but that unconditionally grants access. The thread goes on to provide a better solution:

Just update your httpd-xampp.conf. Replace the End with:

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

Then restart your lampp with: sudo /opt/lampp/lampp restart

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

0
votes

I solved this by creating a new virtual host for phpmyadmin

Append the following to 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>

Change the DocumentRoot/Directory to the path where you have installed your version of phpmyadmin.

Open the C:\Windows\System32\drivers\etc\hosts file in a text editor and add the following line:

127.0.0.1     phpmyadmin.local

then save the hosts file and restart xampp.

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

0
votes

This answer applicable to XAMPP 1.8.2[PHP: 5.4.25]

Just put # mark before Require local below, And importantly, stop and start Apache in xampp control panel.That's it, it definitely work

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

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