Reputation: 301
I am setting up a Symfony project on a new iMac and I have been experiencing an issue, Parse error: syntax error, unexpected ':', expecting ';' or '{' in /myproject/app/cache/dev/appDevDebugProjectContainer.php on line 20043
I have looked into this error, and it seems that a few people believe it is related to the zend framework. I have tried changing the dependency version of zend, and checking all local dependencies but we are still experiencing issues. I have also run brew update
and brew upgrade
I was wondering if anyone has any further suggestions of why this might be occuring?
Thank you!
Upvotes: 0
Views: 1027
Reputation: 632
What you are seeing is a PHP parse error due to a return type being declared on a method, but the version of PHP you are using must not support return types, i.e, your web server is not using PHP 7.
I know you said you're running PHP 7.0.8, but that error seems to indicate otherwise (if Occam's razor is to be trusted). Remember that the PHP version being used by the web server may not be the same version that your shell PATH is finding at the command line. If that is the case, then you need to update your .htaccess to inform the server to use the PHP 7 handler for PHP files. An example:
<FilesMatch \.php$>
SetHandler php70-cgi
</FilesMatch>
You would need to replace php70-cgi with whatever it needs to be for your server. If your installation is hosted on a third-party host, then ask them specifically what handler you should set.
I'm saying all this from experience: I found this thread and it helped me deduce that my problem was exactly this - I needed to update the .htaccess file to inform Apache which PHP handler to use, since my hosting company provides multiples, but the default was not PHP 7.
Upvotes: 1
Reputation: 423
I had a very similar problem when I updated to PHP 7. I found that there is BC in the ocramius proxy manager dependency. Use this version to fix the error: "ocramius/proxy-manager": "^2.0.3"
Upvotes: 0