On my local host I am able to turn the environment from development mode into production mode by changing in .env:
APP_ENV=dev
into
APP_ENV=prod
and after this I clear the cache in the terminal:
php bin/console cache:clear --env=prod
This works fine on the local machine. But on my server I am not able to clear the cache with this command.
The terminal outputs the error:
Parse error: syntax error, unexpected '?' in www/project/bin/console
So on my page I see only:
Oops! An Error Occurred The server returned a "404 Not Found". Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.
Check your console selecte php version. It can differ to the version of php-fpm configured in your nginx virtual host. You need at least 7.1
Check
php -v
If you have multiple php versions installed, you can change current console php version with this:
sudo update-alternatives --config php
I will provide your with a list of possible php versions that currently installed on your server.