配置了PHP后,提示HTTP 404.3 - Not Found 错误

一、检查并修正 PHP FastCGI 处理程序

1. 确保 PHP FastCGI 处理程序已添加

打开 管理员 CMD,执行以下命令检查 PHP 是否正确映射:

%windir%\system32\inetsrv\appcmd list config /section:system.webServer/handlers

如果 *.php 没有映射到 FastCgiModule,或者指向的路径不是 d:\php7433\php-cgi.exe,那么需要手动添加:

%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+"[name='PHP-FastCGI', path='*.php', verb='GET,HEAD,POST', modules='FastCgiModule', scriptProcessor='d:\php7433\php-cgi.exe', resourceType='File']"

然后 重启 IIS

iisreset

web.config文件

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" />
        </staticContent>
        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
                <add value="index.asp" />
            </files>
        </defaultDocument>
        <httpErrors errorMode="Detailed" />
        <handlers>
            <remove name="PHP-FastCGI" />
            <add name="PHP-FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="d:\php7433\php-cgi.exe" resourceType="File" />
        </handlers>
    </system.webServer>
</configuration>

 

posted @ 2025-02-19 10:42  super_ip  阅读(106)  评论(0)    收藏  举报