【问题标题】:Error 500 when deploying Symfony 5 app on IIS在 IIS 上部署 Symfony 5 应用程序时出现错误 500
【发布时间】:2021-08-06 12:36:54
【问题描述】:

所以我目前面临一个问题。

  • IIS 10 和 Symfony 5

我正在尝试在 Microsoft 服务器上部署我的 symfony 应用程序。

因此我面临错误 500,请查看屏幕

还有 web.config 文件

<configuration>
<system.webServer>
<defaultDocument>
<files>
    <clear />
    <add value="index.php" />
</files>
</defaultDocument>
    <rewrite>
        <rules>
            <rule name="Rewriter" stopProcessing="true">
                <match url="^(.*)$" ignoreCase="false" />
                <conditions>
                    <add input="{R:1}" pattern="^(index\\.php|favicon\\.ico)" ignoreCase="false" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                </conditions>
                <action type="Rewrite" url="./index.php/{R:1}" appendQueryString="true" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

我确实将我的网站指向了公共文件。

启用匿名身份验证。

在开发和产品中清除缓存已经完成

它似乎找到了该页面,但无法访问它或其他东西。如果有人有任何线索,它可能会有所帮助,因为我已经做了 3 天了。谢谢

编辑 1:

当我输入这个网址时

http://192.168.1.87:89/login

他意识到他必须打电话给她的控制器

[2021-08-06T12:49:37.795538+00:00] request.INFO:匹配的路由“登录”。 {"route":"login","route_parameters":{"_route":"login","_controller":"App\Controller\DynamicConnectionController::index"},"request_uri":"http://192.168.1.87 :89/login","method":"GET"} []

可能是PHP没有正确配置的问题?

编辑 2

samwu 的解决方案

将活动时间更改为 600 并重新启动服务器。

没用

编辑 3:

最后,我将 web.config 更改为

<configuration>
<system.webServer>
    <rewrite>
        <rules>
            <rule name="Rewriter" stopProcessing="true">
                <match url="^(.*)$" ignoreCase="false" />
                <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                </conditions>
                <action type="Rewrite" url="./index.php" appendQueryString="true" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

我按照 samwu 的建议进行了更改,并且知道我有一个新错误,这次是关于 Mysql。

PHP 警告:未捕获的 PDOException:PDO::__construct():读取问候包时出错。 PID=12136 在 C:\inetpub\wwwroot\lasernet\Symfony\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:39

和

下一个 PDOException: SQLSTATE[HY000] [2006] MySQL 服务器已在 C:\inetpub\wwwroot\lasernet\Symfony\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php:39 中消失/p>

和

PHP 致命错误:C:\inetpub\wwwroot\lasernet\Symfony\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConnection.php 第 42 行中的最大执行时间超过 30 秒

但是我的 mysql 数据库可以很好地访问,当我在本地运行 Symfony 应用程序时,数据库可以正常工作。

【问题讨论】:

  • A 500 错误是一种通用错误消息,几乎涵盖了 PHP 脚本可能出错的每一件事。检查您的服务器错误日志以找出确切的错误消息。

标签: php windows symfony url iis


【解决方案1】:

这个问题应该是FastCGI超时导致的,尝试以下步骤解决:

  1. 打开 iis 管理器。
  2. 选择快速 CGI 设置功能。
  3. 选择您的版本 php-cgi.exe 并在操作窗格中单击编辑。
  4. 设置 600 活动超时值。

完成所有更改后,您需要重新启动iis服务器并重试。

【讨论】:

  • 感谢您的回复,我确实做了您让我做的更改,但仍然无法正常工作。它告诉我“无法访问此页面”。
  • 您可以尝试通过以下方式开箱:support.microsoft.com
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-07-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-20
  • 2021-03-25
相关资源
最近更新 更多