[英]Error after upgrading to Symfony 5.3 and updading flex recipes (symfony:recipes:install --force)
Trying to perform a "minor" version upgrade (5.2 to 5.3) on a fresh/clean symfony 5.2 project (ie composer create-project symfony/website-skeleton:"5.2.*" s5test
)尝试在全新/干净的 symfony 5.2 项目(即
composer create-project symfony/website-skeleton:"5.2.*" s5test
)上执行“次要”版本升级(5.2 到 5.3)
Then i just add a home page for testing purposes ( https://symfony.com/doc/current/page_creation.html )然后我只是添加一个主页用于测试目的( https://symfony.com/doc/current/page_creation.html )
In composer.json: I changed all instances of 5.2.*
to 5.3.*
: "symfony/...": "5.2. " to "symfony/...": "5.3. " "symfony/...": "^5.2 to "symfony/...": "^5.3", etc.在composer.json 中:我将
5.2.*
的所有实例更改为5.3.*
:“symfony/...”:“5.2. ”为“symfony/...”:“5.3. ”“symfony/...” : "^5.2 到 "symfony/...": "^5.3" 等等。
I then execute composer update "symfony/*" --with-all-dependencies
] which runs ok.然后我执行
composer update "symfony/*" --with-all-dependencies
] 运行正常。
To complete the upgrade I need to update the flex recipes for six packages:要完成升级,我需要更新六个软件包的 flex 配方:
all install ok.一切安装正常。
But after installing the symfony/console recipe ( composer recipes:install symfony/console --force -v
), I try running composer update
and the cache:clear
part of the update fails with the error:但是在安装 symfony/console 配方(
composer recipes:install symfony/console --force -v
)之后,我尝试运行composer update
并且cache:clear
部分更新失败并出现错误:
Executing script cache:clear [KO] [KO] Script cache:clear returned with error code 255 !!
执行脚本缓存:清除 [KO] [KO] 脚本缓存:清除返回错误代码 255 !! Script @auto-scripts was called via post-update-cmd
通过 post-update-cmd 调用脚本 @auto-scripts
And after updating the flex recipe for symfony/framework-bundle
( composer recipes:install symfony/framework-bundle --force -v
) I get an blank page when trying to access the application and nothing at var/log/dev.log
在更新
symfony/framework-bundle
的 flex 配方后( composer recipes:install symfony/framework-bundle --force -v
)我在尝试访问应用程序时得到一个空白页面,而var/log/dev.log
没有任何内容
You should install the symfony/runtime
component.您应该安装
symfony/runtime
组件。
After updating the symfony/console
flex recipe you should get an error message similar to this:更新
symfony/console
flex 配方后,您应该会收到类似于以下内容的错误消息:
Which explains what you need to do:这解释了您需要做什么:
composer require symfony/runtime
Install that component and you should be mostly good to go.安装该组件,您应该可以正常使用了。
If you encounter additional issues, pay close attention to the error messages.如果遇到其他问题,请密切注意错误消息。
Additionally, I'd try to run PHP with a more verbose error reporting level while developing/updating, since apparently you are not getting any useful feedback from the application.此外,我会尝试在开发/更新时以更详细的错误报告级别运行 PHP,因为显然您没有从应用程序获得任何有用的反馈。
@yivi his answer is great and fixed the main issue. @yivi 他的回答很好,解决了主要问题。 But after I installed
composer require symfony/runtime
I also had to change public/index.php file.但是在我安装
composer require symfony/runtime
之后,我还必须更改 public/index.php 文件。
It used to be this:以前是这样的:
<?php
use App\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
But is in 5.4 this:但在 5.4 中是这样的:
<?php
use App\Kernel;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
return function (array $context) {
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};
It now works all smooth and perfect.现在一切顺利且完美。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.