1

I'm trying to open my php file as the mail localhost file.But when I do it,I get the following error.I will post below my files and error log.I changed some permissions to Require all granted but it still gives the error.Do you have any suggestions?

Forbidden

You don't have permission to access this resource.
Apache/2.4.48 (Win64) OpenSSL/1.1.1k PHP/7.3.29 Server at localhost Port 80

Here is my httpd-xampp.conf file

XAMPP settings


<IfModule env_module>
    SetEnv MIBDIRS "C:/xampp/php/extras/mibs"
    SetEnv MYSQL_HOME "\\xampp\\mysql\\bin"
    SetEnv OPENSSL_CONF "C:/xampp/apache/bin/openssl.cnf"
    SetEnv PHP_PEAR_SYSCONF_DIR "\\xampp\\php"
    SetEnv PHPRC "\\xampp\\php"
    SetEnv TMP "\\xampp\\tmp"
</IfModule>

#
# PHP-Module setup
#
LoadFile "C:/xampp/php/php7ts.dll"
LoadFile "C:/xampp/php/libpq.dll"
LoadModule php7_module "C:/xampp/php/php7apache2_4.dll"

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>

#
# PHP-CGI setup
#
#<FilesMatch "\.php$">
#    SetHandler application/x-httpd-php-cgi
#</FilesMatch>
#<IfModule actions_module>
#    Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
#</IfModule>


<IfModule php7_module>
    PHPINIDir "C:/xampp/php"
</IfModule>

<IfModule mime_module>
    AddType text/html .php .phps
</IfModule>

ScriptAlias /php-cgi/ "C:/xampp/php/"
<Directory "C:/xampp/php">
    AllowOverride None
    Options None
    Require all denied
    <Files "php-cgi.exe">
          Require all granted
    </Files>
</Directory>

<Directory "C:/xampp/cgi-bin">
    <FilesMatch "\.php$">
        SetHandler cgi-script
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler None
    </FilesMatch>
</Directory>

<Directory "C:/xampp/htdocs/xampp">
    <IfModule php7_module>
        <Files "status.php">
            php_admin_flag safe_mode off
        </Files>
    </IfModule>
    AllowOverride AuthConfig
</Directory>

<IfModule alias_module>
    Alias /licenses "C:/xampp/licenses/"
    <Directory "C:/xampp/licenses">
        Options +Indexes
        <IfModule autoindex_color_module>
            DirectoryIndexTextColor  "#000000"
            DirectoryIndexBGColor "#f8e8a0"
            DirectoryIndexLinkColor "#bb3902"
            DirectoryIndexVLinkColor "#bb3902"
            DirectoryIndexALinkColor "#bb3902"
        </IfModule>
        Require all granted
        ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
   </Directory>

    Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
    <Directory "C:/xampp/phpMyAdmin">
        AllowOverride AuthConfig
        Require all granted
        ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
    </Directory>

    Alias /webalizer "C:/xampp/webalizer/"
    <Directory "C:/xampp/webalizer">
        <IfModule php7_module>
            <Files "webalizer.php">
                php_admin_flag safe_mode off
            </Files>
        </IfModule>
        AllowOverride AuthConfig
        Require all granted
        ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
    </Directory>
</IfModule>

Here is my httpd-vhosts.conf file.

# Virtual Hosts
#
# Required modules: mod_log_config

# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.4/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
##NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ##ServerName or ##ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host.example.com
    ##DocumentRoot "C:/xampp/htdocs/dummy-host.example.com"
    ##ServerName dummy-host.example.com
    ##ServerAlias www.dummy-host.example.com
    ##ErrorLog "logs/dummy-host.example.com-error.log"
    ##CustomLog "logs/dummy-host.example.com-access.log" common
##</VirtualHost>

##<VirtualHost *:80>
    ##ServerAdmin webmaster@dummy-host2.example.com
    ##DocumentRoot "C:/xampp/htdocs/dummy-host2.example.com"
    ##ServerName dummy-host2.example.com
    ##ErrorLog "logs/dummy-host2.example.com-error.log"
    ##CustomLog "logs/dummy-host2.example.com-access.log" common
##</VirtualHost>

And this is my error log.

[Wed Mar 02 12:19:12.201514 2022] [mpm_winnt:crit] [pid 11848:tid 564] AH02538: Child: Parent process exited abruptly. Child process is ending
[Wed Mar 02 12:19:13.448215 2022] [ssl:warn] [pid 1216:tid 564] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Mar 02 12:19:13.500069 2022] [core:warn] [pid 1216:tid 564] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Wed Mar 02 12:19:13.504066 2022] [ssl:warn] [pid 1216:tid 564] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Mar 02 12:19:13.531994 2022] [mpm_winnt:notice] [pid 1216:tid 564] AH00455: Apache/2.4.48 (Win64) OpenSSL/1.1.1k PHP/7.3.29 configured -- resuming normal operations
[Wed Mar 02 12:19:13.531994 2022] [mpm_winnt:notice] [pid 1216:tid 564] AH00456: Apache Lounge VC15 Server built: May 26 2021 14:28:02
[Wed Mar 02 12:19:13.531994 2022] [core:notice] [pid 1216:tid 564] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Wed Mar 02 12:19:13.534951 2022] [mpm_winnt:notice] [pid 1216:tid 564] AH00418: Parent: Created child process 10080
[Wed Mar 02 12:19:13.986776 2022] [ssl:warn] [pid 10080:tid 572] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Mar 02 12:19:14.043624 2022] [ssl:warn] [pid 10080:tid 572] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Wed Mar 02 12:19:14.075540 2022] [mpm_winnt:notice] [pid 10080:tid 572] AH00354: Child: Starting 150 worker threads.
[Wed Mar 02 12:19:14.155296 2022] [autoindex:error] [pid 10080:tid 1844] [client 127.0.0.1:64283] AH01276: Cannot serve directory C:/xampp/htdocs/phishing/: No matching DirectoryIndex (index.php,index.pl,index.cgi,index.asp,index.shtml,index.html,index.htm,index.py,default.php,default.pl,default.cgi,default.asp,default.shtml,default.html,default.htm,default.py,home.php,home.pl,home.cgi,home.asp,home.shtml,home.html,home.htm,home.py) found, and server-generated directory index forbidden by Options directive
DenisDev
  • 11
  • 2
  • 9
  • 1
    Does this answer your question? [Error message "Forbidden You don't have permission to access / on this server"](https://stackoverflow.com/questions/10873295/error-message-forbidden-you-dont-have-permission-to-access-on-this-server) – NcXNaV Mar 02 '22 at 17:38
  • "I'm trying to open my php file **as the mail localhost file**." - What does this mean? What URL are you requesting? What file are you expecting to be served? The conf file you've posted does not appear to cover the request you are making (ie. `C:/xampp/htdocs/phishing/`) and the `httpd-vhosts.conf` file is entirely commented out?! The last line of the error log states whatis causing the 403 response, but you've not stated exactly what you expecting? – MrWhite Mar 03 '22 at 12:55

0 Answers0