If you’re using the XAMPP local development environment to run a WordPress website, you may run into issues from time to time. One of the most common problems you might encounter while trying to access your database is “error 403”, also known as the “XAMPP access forbidden error”.
In a nutshell, XAMPP error 403 means you don’t have the necessary permissions to access or edit the database. In this article, we’ll talk about what XAMPP is, why this error shows up, and how to fix it on both Windows and macOS devices. Let’s get to it!
An Introduction to XAMPP
XAMPP is a local development environment. By installing XAMPP, you’re also setting up all the software you need to host and run local WordPress websites.
As you might know, WordPress has several system requirements, and XAMPP meets all of them. The software stack that you can install on your computer using XAMPP includes:
- Apache: This the server software that enables you to host and serve websites on your computer.
- MariaDB: This is the database software that provides WordPress somewhere to save information, so it can be accessed again as needed.
- PHP: WordPress is built on top of the PHP programming language, so it’s essential to set up the software on your server.
- Perl: Although WordPress doesn’t use the Perl programming language, it comes as part of the software stack that XAMPP configures for you.
You’ve probably run into an error 403 at some point while browsing the web. The error code means that you don’t have the necessary permissions to access a specific file or page:
However, in the context of using XAMPP to run a local WordPress website, error 403 has a different meaning. If you see a message that says “Access forbidden!“, it usually has to do with the XAMPP database.
An Overview of XAMPP Error 403
Typically, XAMPP error 403 appears when you try to access your local database through the browser. In normal circumstances, you can do that by going to the http://localhost/phpmyadmin address using any web browser:
If you don’t have the necessary permissions to access the database, you’ll run into error 403, which reads:
“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.”
As far as error messages go, this one is fairly informative, as it tells you precisely what you need to do to solve the problem. However, before we start troubleshooting, it’s important to note that error 403 usually occurs when there are conflicting port configurations within XAMPP.
Often, the easiest way to bypass the issue is to do as the error message says. In this case, that’s to modify the httpd-xampp.conf file.
How to Troubleshoot XAMPP Error 403 (in Windows and macOS)
XAMPP is available for Windows, macOS, and Linux. In the sections below, we’ll show you how to troubleshoot XAMPP error 403 in both Windows and macOS. If you’re using a Linux distribution, you can follow the macOS instructions.
How to Troubleshoot XAMPP Error 403 in Windows
To get started, go ahead and launch XAMPP, and then start all of the services that your website uses. If you’re running a WordPress website, that would be Apache and MySQL.
Once both services are running, you can click on the Config button along the Apache row, and then select the Apache (httpd-xampp.conf) option:
Now the httpd-xampp.conf file will open via your default text editor. With the file open, use the search feature to look for “phpMyAdmin”. You should see a snippet that looks like this:
Once you’ve located it, you can go ahead and delete the text that says “Require local” and replace it with “Require all granted”:
Save the changes to httpd-xampp.conf and close the file. Then you can restart both the Apache and MySQL services from the XAMPP control panel. Once the services are running again, you can try accessing your database once more by navigating to localhost/phpmyadmin in your browser.
How to Troubleshoot XAMPP Error 403 in macOS
Fixing XAMPP error 403 on macOS involves almost the same steps as it does for Windows devices. However, accessing the httpd-xampp.conf file is not precisely the same, since the XAMPP control panel looks a bit different:
Despite the difference in style, accessing the file you need is still simple. Here are the five steps to follow:
- Go to the Volumes tab in the XAMPP control panel.
- Select the Mount option at the top of the screen.
- Click on the Explore button next to Mount once it becomes selectable.
- In the explorer window that pops up, navigate to etc/extra.
- Open the http-xampp.conf file.
Once the file is open, you can look for “phpmyadmin”within it. The snippet you see should look like this:
Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
<Directory "C:/xampp/phpMyAdmin">
AllowOverride AuthConfig
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
Next, you can replace the part that says “Require local” with “Require all granted”, and save the changes to the file. Now return to the XAMPP control panel, go to the “Services” tab, and click on Restart All. After all the XAMPP services are backed up, you should be able to access your database without problems.
Summary
Being able to access your website’s database is critical, whether you’re using a live server or a local development environment such as XAMPP. Although XAMPP error 403 can be annoying, it’s easy to solve whether you’re using Windows, macOS, or Linux.
All you have to do is edit the XAMPP httpd-xampp.conf file to ensure that everyone has access to phpMyAdmin. Then the 403 error should disappear right away.
If you want access to a local WordPress development environment that is easy to use and troubleshoot, we recommend giving DevKinsta a try. DevKinsta is available for free whether you’re a Kinsta user or not, and you can use it to set up many local WordPress websites as you need!
As I can see in your question, you are using Apache 2.4.7, but your httpd.conf use Apache 2.2 directive.
According to Apache 2.4 manual:
Access control
In 2.2, access control based on client hostname, IP address, and other
characteristics of client requests was done using the directives
Order, Allow, Deny, and Satisfy.In 2.4, such access control is done in the same way as other
authorization checks, using the new module mod_authz_host. The old
access control idioms should be replaced by the new authentication
mechanisms, although for compatibility with old configurations, the
new module mod_access_compat is provided.
Try this changes:
<Directory "/opt/lampp/apache2/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Allow and deny directive controls which hosts can or can’t access an area of the server, Require tests whether an authenticated user is authorized according to a particular authorization provider and the specified restrictions. Require all granted means access is allowed unconditionally, let see Beyond just authorization
Update after reading configuration file:
Your default configuration file is right. The problem is wrong shebang in perl script.
Try this:
#!/usr/bin/perl
Also:
chmod +x /opt/lampp/cgi-bin/yourScript.pl
Here is a useful link about file permission problem
Second update
Change http content header:
print "Content-type:text/htmln";
This header is read by apache.
You apache is running as daemon
user, check if each directory in script path are readable.
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?
I am running Arch Linux and I decided to use XAMPP so I can create and test web pages. Anyway, I followed the instructions given in the site and extracted it to /opt/lampp
and I also uncommented the line in /opt/lampp/etc/httpd.conf
so mod_userdir
will be enabled.
Now, when I try to access my user public_html
(via http://localhost/~user), I get this error:
Access forbidden!
You don't have permission to access the requested object. It is either
read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
How do I get this to work?
Jeff Schaller♦
66k35 gold badges110 silver badges245 bronze badges
asked Mar 8, 2012 at 16:04
You need to make the public_html and the files there readable by the web server.
One way is to run chmod o+x /home/user
(allow everyone to switch to the home directory)
and chmod -R o+rX /home/user/public_html
(make public_html and files there readable by everyone).
If you need better access controls, use ACLs.
answered Mar 8, 2012 at 16:32
jofeljofel
26.4k6 gold badges65 silver badges91 bronze badges
You need to use this
<Directory "/Users/*/Sites">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
make sure you use Require all granted
instead of
Order allow,deny
Allow from all
when using apache >2.4
answered Aug 8, 2013 at 20:50
dersimndersimn
3253 silver badges8 bronze badges
1
The default httpd.conf
file makes all directories unavailable:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
You need to configure Apache to allow access to your directory(s):
<Directory "/srv/httpd/htdocs">
Order allow,deny
Allow from all
</Directory>
That’s at a minimum. You might have to do some other things. Get the 403 response, then look in /var/log/httpd/error_log
(or wherever XAMPP puts it) to see what went on.
answered Mar 8, 2012 at 16:42
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.
I have installed Ubuntu and XAMPP on my computer but when i start the web server and go to htt://localhost/webname (webname is the folder name inside htdocs) i receive error 403.
There .htaccess inside webname is the following:
# Created on: 03/01/2012
# Author: **********
# Redirect every request to index.php
RewriteEngine on
RewriteBase /
RewriteRule ^$ /webname/public/index.php
RewriteRule ^about/?$ /webname/public/about.php
RewriteRule ^changelog/?$ /webname/public/changelog.php
RewriteRule ^home/?$ /webname/public/home.php
RewriteRule ^friends/?$ /webname/public/friends.php
RewriteRule ^(w+)/?$ /webname/public/home.php?user=$1
RewriteRule ^login/?$ /webname/public/index.php?show=login
RewriteRule ^signup/?$ /webname/public/index.php?show=signup
RewriteRule ^profile/(w+)/?$ /webname/public/profile.php?user=$1
# Rewrite www.webname.com -> webname.com
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Disable directory listing for all the subdirectories
Options -Indexes
On Windows everything works fine but on Ubuntu i keep receiving this error.
Thanks for helping.