Score:1

Symfony vendor autoload_runtime

in flag

When I try to do : symfony console d:d:c

to initiate my database I have :

Parse error: syntax error, unexpected '?' in C:\Users\user\my_project_name\vendor\autoload_runtime.php on line 21 exit status 255

Here is the autoload_runtime file :


// autoload_runtime.php @generated by Symfony Runtime

if (true === (require_once __DIR__.'/autoload.php') || empty($_SERVER['SCRIPT_FILENAME'])) {
    return;
}

if (PHP_VERSION_ID < 80000 && in_array(PHP_SAPI, ['cli', 'phpdbg'], true)) {
    ob_start();
    $app = require $_SERVER['SCRIPT_FILENAME'];
    ob_end_clean();
} else {
    $app = require $_SERVER['SCRIPT_FILENAME'];
}

if (!is_object($app)) {
    throw new TypeError(sprintf('Invalid return value: callable object expected, "%s" returned from "%s".', get_debug_type($app), $_SERVER['SCRIPT_FILENAME']));
}

$runtime = $_SERVER['APP_RUNTIME'] ?? 'Symfony\\Component\\Runtime\\SymfonyRuntime';
$runtime = new $runtime(($_SERVER['APP_RUNTIME_OPTIONS'] ?? []) + [
  'project_dir' => dirname(__DIR__, 1),
]);

[$app, $args] = $runtime
    ->getResolver($app)
    ->resolve();

$app = $app(...$args);

exit(
    $runtime
        ->getRunner($app)
        ->run()
);

I don't know where the problem is, can someone help please ?

NB : I put a .php-version in my symfony project with my current version inside and it works.

Question done !

in flag
My php version : C:\Users\user\my_project_name>php -v PHP 7.4.9 (cli) (built: Aug 4 2020 11:52:41) ( ZTS Visual C++ 2017 x64 ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies
in flag
If you managed to solve your problem, please post it as an answer and accept it when you can. Otherwise the question will stay as unsolved in the system forever. While you are at it, the information about PHP you added as an answer should be an edit to your question instead.
at flag
maybe the php run from CLI is not the same as the one running on the webserver... try a phpinfo()
Score:1
at flag

Your PHP doesn't understand the "null coalesce operator" ??, that was introduced in PHP 7, that means you're using a PHP 5.x version.

The current version of Symfony (5.3) requires PHP 7.2.5 or higher. (but php7.2 is already end of life, you should upgrade to PHP 7.4 or 8.0)

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.