php - Error after upgrading to Symfony 5.3 and updading flex recipes (symfony:recipes:install --force)
Solution:
You should install the symfony/runtime
component.
After updating the symfony/console
flex recipe you should get an error message similar to this:
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.
Answer
Solution:
@yivi his answer is great and fixed the main issue. But after I installed composer require symfony/runtime
I also had to change public/index.php file.
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:
<?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.
Source