3

I have the following simple command:

 $process = new Process("php /Users/Name/Sites/App/app/../bin/console cache:clear --env=prod");
 $process->run();

when I try to run this it gives me:

string(153) " Parse error: parse error in /Users/Name/Sites/App/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php on line 278 "

What is wrong?

luchaninov
  • 6,792
  • 6
  • 60
  • 75
adit
  • 32,574
  • 72
  • 229
  • 373
  • 1
    php version? DependencyInjection component version? – Dmytro Mar 04 '16 at 07:35
  • In my projects `console`'s path is `app/console` instead of `bin/console`. Are you sure about your path? – user2340612 Mar 04 '16 at 09:09
  • Please add the PHP and Symfony versions in your question. As it's written, it's hard to answer to this question because there's too little information. – A.L Mar 07 '16 at 12:58

2 Answers2

3

Looks like you are using Symfony 3.0 that has "finally" https://github.com/symfony/symfony/blob/3.0/src/Symfony/Component/DependencyInjection/Container.php#L282

PHP 5.5 and later has support for "finally" in try/catch blocks. http://php.net/manual/en/language.exceptions.php

And looks like your php version is less then 5.5, so upgrade your php version > 5.5 and it will work

Evgeniy Kuzmin
  • 2,384
  • 1
  • 19
  • 24
  • 1
    Specifically, Symfony 3.0 [requires PHP >=5.5.9](https://github.com/symfony/symfony/blob/3.0/composer.json). – A.L Mar 06 '16 at 01:40
  • 1
    Yes, exactly, thanks for more presize version http://symfony.com/doc/current/reference/requirements.html – Evgeniy Kuzmin Mar 06 '16 at 11:40
-1
$process = new Process("php /Users/Name/Sites/App/app/../bin/console cache:clear --env=prod");
$process->run();

You should try

$process = new Process("php /Users/Name/Sites/App/app/console cache:clear --env=prod");
 $process->run();

Because console is in app/ directory and not in bin/

S.Alfano
  • 21
  • 9