I am trying to upgrade the Symfony version from 3.4 to 4.3 but the requirement is to keep the same folder structure as it was in 3.4 because of namespaces and other dependencies.
![enter image description here]()
My Findings:
1. Part of the setup is done. Need to configure for completion.
2. In the new version, we need to inject other classes or service as like an Argument in method
But the problem is that while I install / update composer it always returns:
Script Symfony-cmd handling the auto-scripts event returned with error code 127
Script @auto-scripts was called via post-install-cmd
and Another Big problem is there in app.php
or app_dev.php
Here is my JSON:
{
"name": "web",
"license": "proprietary",
"type": "project",
"description": " Web",
"autoload": {
"psr-4": { "": "src/" },
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
},
"require": {
"php": ">=7.1",
"symfony/symfony": "^3.4",
"twig/twig": "^1.35",
"symfony/monolog-bundle": "^3",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"leaseweb/api-caller-bundle": "1.2.*",
"twig/extensions": "^1.3",
"jms/serializer-bundle": "^1.0.0",
"lexik/jwt-authentication-bundle": "^1.7",
"stof/doctrine-extensions-bundle": "^1.2",
"knplabs/knp-menu-bundle": "^2.0",
"misd/phone-number-bundle": "1.1.*",
"snilius/twig-sort-by-field": "^0.1.5",
"suncat/mobile-detect-bundle": "1.0.*",
"predis/predis": "^1.0",
"snc/redis-bundle": "^2",
"guzzlehttp/guzzle": "^6",
"leafo/scssphp": "^0.6.7",
"symfony/assetic-bundle": "^2.8",
"eightpoints/guzzle-bundle": "dev-master",
"friendsofsymfony/jsrouting-bundle": "^1.6",
"jms/security-extra-bundle": "^1.6",
"gpslab/geoip2": "^1.1",
"ext-json" : "*",
"alcaeus/mongo-php-adapter": "^1.1"
},
"require-dev": {
"sensio/generator-bundle": "~3.0",
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget",
"WebBundle\\Composer\\ScriptHandler::createProfilePicDirectory"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget",
"WebBundle\\Composer\\ScriptHandler::createProfilePicDirectory"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "stable",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "1.2-dev"
}
}
}
in APP.PHP
<?php
use Symfony\Component\HttpFoundation\Request;
/**
* @var Composer\Autoload\ClassLoader
*/
$loader = require __DIR__.'/../app/autoload.php';
include_once __DIR__.'/../app/bootstrap.php.cache';
// Enable APC for autoloading to improve performance.
// You should change the ApcClassLoader first argument to a unique prefix
// in order to prevent cache key conflicts with other applications
// also using APC.
/*
$apcLoader = new Symfony\Component\ClassLoader\ApcClassLoader(sha1(__FILE__), $loader);
$loader->unregister();
$apcLoader->register(true);
*/
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);
// When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
//Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
Request::setTrustedHeaderName(Request::HEADER_FORWARDED, null);
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
ERRORS are getting :
ERROR 1. while composer install ->Script Symfony-cmd handling the auto-scripts event returned with error code 127
ERROR 2. $response = $kernel->handle($request);
in app.php
Other API routes are working but for the handler, I am getting the error for app.php
file.