尝试使用 IIS 创建自定义错误页面(服务器正在使用 php)

Trying to create a custom error page with IIS (server is using php)

标题就是这么写的。我只是无法使 web.config 文件正常工作。如果有人知道我在这里做错了什么,那就太好了。 http_error_handler.php 在url 中获取get 请求并根据该请求显示错误。

web.config

的内容
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <defaultDocument>
            <files>
                <remove value="index.php" />
                <add value="index.php" />
            </files>
        </defaultDocument>
        <httpErrors>
            <clear />
            <remove statusCode="403" subStatusCode="-1"></remove>
            <remove statusCode="404" subStatusCode="-1"></remove>
            <remove statusCode="405" subStatusCode="-1"></remove>
            <remove statusCode="408" subStatusCode="-1"></remove>
            <remove statusCode="500" subStatusCode="-1"></remove>
            <remove statusCode="502" subStatusCode="-1"></remove>
            <remove statusCode="504" subStatusCode="-1"></remove>
            <error statusCode="403" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error>
            <error statusCode="404" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error>
            <error statusCode="405" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error>
            <error statusCode="408" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error>
            <error statusCode="500" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error>
            <error statusCode="502" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error>
            <error statusCode="504" path="/php/handlers/http_error_handler.php" responseMode="ExecuteURL"></error>
        </httpErrors>
    </system.webServer>
    <system.web>
        <customErrors mode="On">
            <error statusCode="403" redirect="/php/handlers/http_error_handler.php?status=403"></error>
            <error statusCode="404" redirect="/php/handlers/http_error_handler.php?status=404"></error>
            <error statusCode="405" redirect="/php/handlers/http_error_handler.php?status=405"></error>
            <error statusCode="408" redirect="/php/handlers/http_error_handler.php?status=408"></error>
            <error statusCode="500" redirect="/php/handlers/http_error_handler.php?status=500"></error>
            <error statusCode="502" redirect="/php/handlers/http_error_handler.php?status=502"></error>
            <error statusCode="504" redirect="/php/handlers/http_error_handler.php?status=504"></error>
            </customErrors>
        </system.web>
    </configuration>

替换

<httpErrors>

<httpErrors errorMode="Custom">