在 Heroku 上部署 Symfony 5 时出错

问题描述 投票:0回答:1

我真的需要这方面的帮助。我创建了一个应用程序(具有登录和注册功能),可让您监控正在进行的项目及其相关任务。每个项目都有一个用户作为创建者。我将它部署在 Heroku 上,当我创建项目时,我应该被重定向到我的帐户 (

/account
) 并列出所有项目,但它不起作用。我知道该项目已创建,因为我可以在另一个 URL(如
/project/[id]/details
)上看到其详细信息,但我无法再返回到
/account
URL。我在我的网站上收到此错误:

Oops! An Error Occurred
The server returned a "500 Internal Server Error".

Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.

我的 Heroku 日志:

2022-05-17T10:13:06.508011+00:00 heroku[router]: at=info method=GET path="/account" host=ebi-tracker.herokuapp.com request_id=51d1ce91-7b3d-4619-9692-cd8fcb849910 fwd="77.198.36.214" dyno=web.1 connect=0ms service=23ms status=500 bytes=1113 protocol=https

2022-05-17T10:13:06.503594+00:00 app[web.1]: [2022-05-17T10:13:06.502577+00:00] deprecation.INFO: Deprecated: uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero {"exception":"[object] (ErrorException(code: 0): Deprecated: uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero at /app/vendor/twig/twig/src/Extension/CoreExtension.php:940)"} []

2022-05-17T10:13:06.506126+00:00 app[web.1]: {"message":"Matched route \"app_account\".","context":{"route":"app_account","route_parameters":{"_route":"app_account","_controller":"App\\Controller\\UserController::account"},"request_uri":"http://ebi-tracker.herokuapp.com/account","method":"GET"},"level":200,"level_name":"INFO","channel":"request","datetime":"2022-05-17T10:13:06.486637+00:00","extra":{}}

2022-05-17T10:13:06.506484+00:00 app[web.1]: {"message":"Checking for authenticator support.","context":{"firewall_name":"main","authenticators":1},"level":100,"level_name":"DEBUG","channel":"security","datetime":"2022-05-17T10:13:06.486973+00:00","extra":{}}

2022-05-17T10:13:06.506917+00:00 app[web.1]: {"message":"Checking support on authenticator.","context":{"firewall_name":"main","authenticator":"App\\Security\\LoginAuthenticator"},"level":100,"level_name":"DEBUG","channel":"security","datetime":"2022-05-17T10:13:06.486978+00:00","extra":{}}

2022-05-17T10:13:06.507429+00:00 app[web.1]: {"message":"Authenticator does not support the request.","context":{"firewall_name":"main","authenticator":"App\\Security\\LoginAuthenticator"},"level":100,"level_name":"DEBUG","channel":"security","datetime":"2022-05-17T10:13:06.486983+00:00","extra":{}}

2022-05-17T10:13:06.507973+00:00 app[web.1]: {"message":"Read existing security token from the session.","context":{"key":"_security_main","token_class":"Symfony\\Component\\Security\\Http\\Authenticator\\Token\\PostAuthenticationToken"},"level":100,"level_name":"DEBUG","channel":"security","datetime":"2022-05-17T10:13:06.499829+00:00","extra":{}}

2022-05-17T10:13:06.508459+00:00 app[web.1]: {"message":"User was reloaded from a user provider.","context":{"provider":"Symfony\\Bridge\\Doctrine\\Security\\User\\EntityUserProvider","username":"[email protected]"},"level":100,"level_name":"DEBUG","channel":"security","datetime":"2022-05-17T10:13:06.502157+00:00","extra":{}}

2022-05-17T10:13:06.509406+00:00 app[web.1]: {"message":"Deprecated: uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero","context":{"exception":{"class":"ErrorException","message":"Deprecated: uasort(): Returning bool from comparison function is deprecated, return an integer less than, equal to, or greater than zero","code":0,"file":"/app/vendor/twig/twig/src/Extension/CoreExtension.php:940"}},"level":200,"level_name":"INFO","channel":"deprecation","datetime":"2022-05-17T10:13:06.502577+00:00","extra":{}}

2022-05-17T10:13:06.511950+00:00 app[web.1]: {"message":"Uncaught PHP Exception Twig\\Error\\RuntimeError: \"An exception has been thrown during the rendering of a template (\"The Symfony\\Polyfill\\Intl\\Icu\\IntlDateFormatter::__construct() method's argument $locale value 'fr' behavior is not implemented. Only the locale \"en\" is supported.  Please install the \"intl\" extension for full localization capabilities.\").\" at /tmp/build_4ffe4d79/templates/pages/account/index.html.twig line 29","context":{"exception":{"class":"Twig\\Error\\RuntimeError","message":"An exception has been thrown during the rendering of a template (\"The Symfony\\Polyfill\\Intl\\Icu\\IntlDateFormatter::__construct() method's argument $locale value 'fr' behavior is not implemented. Only the locale \"en\" is supported.  Please install the \"intl\" extension for full localization capabilities.\").","code":0,"file":"/tmp/build_4ffe4d79/templates/pages/account/index.html.twig:29","previous":{"class":"Symfony\\Polyfill\\Intl\\Icu\\Exception\\MethodArgumentValueNotImplementedException","message":"The Symfony\\Polyfill\\Intl\\Icu\\IntlDateFormatter::__construct() method's argument $locale value 'fr' behavior is not implemented. Only the locale \"en\" is supported.  Please install the \"intl\" extension for full localization capabilities.","code":0,"file":"/app/vendor/symfony/polyfill-intl-icu/IntlDateFormatter.php:148"}}},"level":500,"level_name":"CRITICAL","channel":"request","datetime":"2022-05-17T10:13:06.505321+00:00","extra":{}}

2022-05-17T10:13:06.512287+00:00 app[web.1]: {"message":"Stored the security token in the session.","context":{"key":"_security_main"},"level":100,"level_name":"DEBUG","channel":"security","datetime":"2022-05-17T10:13:06.506763+00:00","extra":{}}

2022-05-17T10:13:06.512571+00:00 app[web.1]: 10.1.27.78 - - [17/May/2022:10:13:06 +0000] "GET /account HTTP/1.1" 500 831 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0
php symfony heroku
1个回答
1
投票

未捕获的 PHP 异常 Twig\Error\RuntimeError:“在渲染模板期间引发异常(”Symfony\Polyfill\Intl\Icu\IntlDateFormatter::__construct() 方法的参数 $locale 值 'fr' 行为不是仅支持语言环境“en”。请安装“intl”扩展以获得完整的本地化功能。

因此,安装

intl
扩展

在 Heroku 您可以通过添加

ext-intl
作为
composer.json
中的依赖项来做到这一点:

{
    "require": {
        "ext-intl": "*"
    }
}

然后提交并重新部署。

您可能还必须启用适当的区域设置,但首先看看上述内容是否可以单独工作。

© www.soinside.com 2019 - 2024. All rights reserved.