Search code examples
phpsymfonyphp-5.4

Symfony2 on php 5.4


I need to change my Symfony2 website to a new server and I've noticed that the new server is currently installed php 5.4, when Symfony2 need a minimum of 5.5.9. By doing some tests they are taking place some errors like:

php.CRITICAL: Fatal Parse Error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) {"type":4,"file":"/home/admin/web/websitename.com/app/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php","line":62,"level":6143,"stack":[]} []

which is probably product of the version. I wonder if anyone has had this problem and has installed a Symfony2 in php 5.4, maybe down to an older version of the framework. I know that the easy way it would be to update the version of php but currently that's not an option.

Thanks in advance


Solution

  • Since the problem seems to be in doctrine common bundle I try with some old version of it, looking for some one compatible with php 5.4, specifically someone when the function::class is not used. Finally it work with the next combination:

    "doctrine/common": "2.4.2",
    "doctrine/dbal": "2.4.4",
    "doctrine/orm": "2.4.7",
    "doctrine/doctrine-bundle": "~1.2"
    

    Update composer and done.