Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can't I access Xampp's phpmyadmin on localhost? Access is forbidden.

I can access localhost fine on Xampp with phpmyadmin on ubuntu. I can see the contents of /htdocs which I completely cleared and wrote my own for. I want to access phpmyadmin, but cannot.

When loading phomyadmin, I am greeted by a 403 Error and a note advising me to configure the setting in the file httpd-xampp.conf. I looked in /opt/lampp/etc/extra/httpd-xampp.conf, but have no idea what to configure.

Two areas within the file seem useful in this scenario:

<Directoy "/opt/lampp/phpmyadmin">
    AllowOverride AuthConfig Limit
    Order allow,deny
    Deny From all
</Directory>

and

#
# New XAMPP security concept
#

<LocationMatch "^/(?: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 \
    fe00::/10 169.254.0.0/16

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

In both segments I tried changing "Deny from all" to "Allow from all" and restarted Xampp with the command sudo /opt/lampp/lampp restart. I received the same error page as before. I tried other solutions found online, but none have worked.

What do I have to configure to access phpmyadmin?

like image 924
Andrew Fairbairn Avatar asked Sep 06 '12 20:09

Andrew Fairbairn


People also ask

Why phpMyAdmin is not working on localhost?

You may receive an error message stating that phpMyAdmin needs a PHP version within a specific range. This might happen if you're running an outdated version of PHP, or a new update is not compatible with your version of MAMP. In this case, you”ll need to change the PHP version of your MAMP application.

How do I access phpMyAdmin on localhost XAMPP?

In the basic configuration of XAMPP, phpMyAdmin is accessible only from the same host that XAMPP is running on, at http://127.0.0.1 or http://localhost. Before you can access the MySQL server, phpMyAdmin will prompt you for a user name and password.


2 Answers

The solution can be found here. Summary follows:

Edit /opt/lampp/etc/extra/httpd-xampp.conf.

Add the line Require all granted to the bottom of the <Directory "/opt/lampp/phpmyadmin"> block as follows:

<Directory "/opt/lampp/phpmyadmin">
  AllowOverride AuthConfig Limit
  Order allow,deny
  Allow from all
  Require all granted
</Directory>
like image 90
Sumit Munot Avatar answered Oct 12 '22 12:10

Sumit Munot


I solved this by creating a new virtual host for phpmyadmin

For windows systems:

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.

like image 29
Andy Avatar answered Oct 12 '22 11:10

Andy