Access forbidden! - Updated PHP and XAMPP

Good Morning,

I updated my PHP and XAMPP to latest version but since doing so can no longer access the site locally. below are all the snippets that i think could cause it. sorry as there are a few.

the error log shows:

[Thu Jun 04 08:59:44.481252 2020] [authz_core:error] [pid 40368:tid 1600] [client 127.0.0.1:2883] AH01630: client denied by server configuration: C:/xampp/htdocs/

the .htaccess

RewriteEngine on

# hide files and folders
RedirectMatch 404 /_protected
RedirectMatch 404 /\.git
RedirectMatch 404 /composer\.
RedirectMatch 404 /.bowerrc

# If a directory or a file exists, use the request directly

RewriteBase /

RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,NE,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d


# Otherwise forward the request to index.php
RewriteRule . index.php

the virtual host:

<VirtualHost *:80>
ServerName frontend.test
DocumentRoot “C:/xampp/htdocs/public_html/”

<Directory "C:/xampp/htdocs/public_html/">
    # use mod_rewrite for pretty URL support
    RewriteEngine on
    # If a directory or a file exists, use the request directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # Otherwise forward the request to index.php
    RewriteRule . index.php

    # use index.php as index file
    DirectoryIndex index.php

    # ...other settings...
    # Apache 2.4
    Require all granted
    
    ## Apache 2.2
    # Order allow,deny
    # Allow from all
</Directory>

<VirtualHost *:80>
ServerName backend.test
DocumentRoot “C:/xampp/htdocs/public_html/backend/”

<Directory "C:/xampp/htdocs/public_html/backend/">
    # use mod_rewrite for pretty URL support
    RewriteEngine on
    # If a directory or a file exists, use the request directly
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # Otherwise forward the request to index.php
    RewriteRule . index.php

    # use index.php as index file
    DirectoryIndex index.php

    # ...other settings...
    # Apache 2.4
    Require all granted
    
    ## Apache 2.2
    # Order allow,deny
    # Allow from all
</Directory>

the httpd.config:

# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other 
# <Directory> blocks below.
#
<Directory />
    AllowOverride none
    Require all denied
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:/xampp/htdocs/public_html/"
<Directory "C:/xampp/htdocs/public_html/">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks Includes ExecCGI

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

It’s been a long time since I have used wamp/xampp so I might not be very accurate but in the log it appears you use port 2883 and all your hosts are exposed at port 80. Does it help when you change *:80 to *:*?

hadn’t noticed that! strange as XAMPP is set to 80 and seems to be running on 80 but that shows different!

have changed in the Vhosts doesn’t make any difference error log:

[client 127.0.0.1:3780] AH01630: client denied by server configuration: C:/xampp/htdocs/

Do you use an alternative that you find better?

So, restarted everything and changed

<Directory />
    AllowOverride none
    Require all granted
</Directory>

to granted (i believe security risk but want to test)

i now get access to backend.test but not frontend.test

Hmm, is it yours port in this case? I’m not sure what is going on there but vhost port was ok.

Anyway, this is development environment, right? Why do you worry about restrict the access then?

But I’m sorry I don’t know how to help you. Error like that usually states that something wrong with access to Directory is going on. I would suggest to switch to docker but of course this is not constructive with this issue.

Do you use an alternative that you find better?

wsl/wsl2 with apache and mysql