phpsymfonyterminalconsolephp-parse-error

How can I prevent an unexpected Syntax error?


I tried to execute this command in the terminal:

php bin/console cache:clear --env=prod --no-debug

But I get the following error message:

Parse error: syntax error, unexpected '?' in /is/htdocs/myhost/www/project/bin/console on line 26

Solution

  • Symfony4 requires PHP v7.1.3 or higher.

    Check your PHP version using php -v.

    If you have the correct version try running composer install. This will install any missing dependencies and should fix the error.