Symfony bin/console throws the Symfony\Component\ErrorHandler\Error\UndefinedFunctionError when we try to execute a command on cPanel (but everything works on local server).
It produces an error because of the shell_exec function. It happens on the versions 6.1 and 6.2: Error Message -example of an executed command: "php bin/console list"
`Symfony\Component\ErrorHandler\Error\UndefinedFunctionError^ {#158
#message: "Attempted to call function "shell_exec" from namespace "Symfony\Component\Console"."
#code: 0
#file: "./vendor/symfony/console/Application.php"
#line: 981
trace: {
./vendor/symfony/console/Application.php:981 { …}
./vendor/symfony/framework-bundle/Console/Application.php:97 { …}
./vendor/symfony/console/Application.php:301 { …}
./vendor/symfony/framework-bundle/Console/Application.php:80 { …}
./vendor/symfony/console/Application.php:171 { …}
./vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:54 { …}
./vendor/autoload_runtime.php:29 { …}
./bin/console:11 {
›
› require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
›
arguments: {
"/home/***/****/vendor/autoload_runtime.php"
}
}
}
}`
Symfony version and console version "symfony/console": "6.1.","symfony/framework-bundle": "6.1."
Php version: 8.1
NB: When we replace the shell_exec whith exec, it works as expected.