I am using Symfony 2.8.1 and work on Windows 8 with WAMP Server 2, Apache 2.4.2 and PHP 5.4.3 I have installed Symfony with the command tool with success, but when I try to access the url http://localhost/Symfony/web/app_dev.php/ I get this error message :
FatalErrorException in ProxyGenerator.php line 62: Parse Error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING)
Then this list of errors :
in ProxyGenerator.php line 62
at DebugClassLoader->loadClass() in EntityManager.php line 0
at ProxyFactory->__construct() in EntityManager.php line 166
at EntityManager->__construct() in EntityManager.php line 850
at EntityManager::create() in appDevDebugProjectContainer.php line 605
at appDevDebugProjectContainer->getDoctrine_Orm_DefaultEntityManagerService() in Container.php line 312
at Container->get() in classes.php line 6695
at ManagerRegistry->getService() in classes.php line 6665
at AbstractManagerRegistry->getManagers() in DoctrineDataCollector.php line 65
at DoctrineDataCollector->collect() in Profiler.php line 218
at Profiler->collect() in ProfilerListener.php line 128
at ProfilerListener->onKernelResponse() in WrappedListener.php line 61
at call_user_func() in WrappedListener.php line 61
at WrappedListener->__invoke() in classes.php line 1853
at call_user_func() in classes.php line 1853
at EventDispatcher->doDispatch() in classes.php line 1771
at EventDispatcher->dispatch() in TraceableEventDispatcher.php line 132
at TraceableEventDispatcher->dispatch() in HttpKernel.php line 179
at HttpKernel->filterResponse() in HttpKernel.php line 161
at HttpKernel->handleRaw() in HttpKernel.php line 62
at HttpKernel->handle() in ContainerAwareHttpKernel.php line 69
at ContainerAwareHttpKernel->handle() in Kernel.php line 185
at Kernel->handle() in app_dev.php line 30
at {main}() in app_dev.php line 0
On line 62 of ProxyGenerator.php :
protected $placeholders = [
'baseProxyInterface' => Proxy::class,
'additionalProperties' => '',
];
The issue seems to be this :
Proxy::class
When I change it into that :
'Doctrine\Common\Proxy\Proxy'
It works !
I'd like to know what's happening and if the change I made is a solution for real.
Any thoughts ? Thanks.
This is a PHP version problem. You need at least PHP 5.5.
It's because ProxyGenerator
uses the static class
keyword for class name resolution.
So, update your Wamp server to something where PHP > 5.5 and you should be good to go !
Source : https://secure.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class
You can run composer update
to re-install the vendor library versions that are compatible with your PHP version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With