【发布时间】:2022-07-14 22:02:53
【问题描述】:
我正在尝试将我的 php 文件作为邮件 localhost 文件打开。但是当我这样做时,我收到以下错误。我将在我的文件和错误日志下面发布。我将一些权限更改为需要所有已授予但它还是报错。有什么建议吗?
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
这是我的 httpd-xampp.conf 文件
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>
这是我的 httpd-vhosts.conf 文件。
# 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>
这是我的错误日志。
[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
【问题讨论】:
-
"我正在尝试打开我的 php 文件 作为邮件 localhost 文件。" - 这是什么意思?你要什么网址?您希望提供什么文件?您发布的 conf 文件似乎没有涵盖您提出的请求(即
C:/xampp/htdocs/phishing/)并且httpd-vhosts.conf文件被完全注释掉了?!错误日志的最后一行说明了导致 403 响应的原因,但您没有准确说明您的预期?