【发布时间】: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:
当我输入这个网址时
他意识到他必须打电话给她的控制器
[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