-3

How to use app/console command line on shared servers?

When I try to flush de cache for example with:

app/console cache:clear -e prod;

I keep getting this kind of errors:

PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) in /home/clients/f61b2e8462ca91d597e79838efafc0d1/krown/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php on line 62

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) in /home/clients/f61b2e8462ca91d597e79838efafc0d1/krown/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php on line 62

[Symfony\Component\Debug\Exception\FatalErrorException]
Parse Error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING)

In my dedicated server I dont' have this kind of error. The same PHP version (7.1) is installed in both servers.

Kr1
  • 1,269
  • 2
  • 24
  • 56
  • 2
    This looks like a PHP version problem. What does php -v show? – Chris Mar 23 '18 at 13:26
  • This question is already answered https://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them – Jose M. González Mar 23 '18 at 13:40
  • Thank you @Chris, thanks to your comment I realized that the PHP version installed in the user PATH when connecting with SSH was the 5.4 instead 7.1 (as configured in Admin Panel) – Kr1 Mar 23 '18 at 14:28

1 Answers1

0

I was able to solve my issue by forcing the PHP version appending it to all my "app/console" queries, for example:

php-7.1 app/console cache:clear -e prod
php-7.1 app/console cache:clear -e dev
php-7.1 app/console doctrine:generate:entity
php-7.1 app/console doctrine:generate:entities Front
php-7.1 app/console doctrine:schema:update --dump-sql
php-7.1 app/console doctrine:schema:update --force
Kr1
  • 1,269
  • 2
  • 24
  • 56