我正在使用Symfony 2.8.1并使用WAMP Server 2,Apache 2.4.2和PHP 5.4.3在Windows 8上工作 我已经使用命令工具成功安装了Symfony,但是当我尝试访问URL时http:// localhost /Symfony/web/app_dev.php/我收到此错误消息:
FatalErrorException in ProxyGenerator.php line 62: Parse Error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING)
然后是这个错误列表:
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
在ProxyGenerator.php的第62行:
protected $placeholders = [ 'baseProxyInterface' => Proxy::class, 'additionalProperties' => '', ];
问题似乎是这样的:
Proxy::class
当我把它改成那样:
'Doctrine\Common\Proxy\Proxy'
有用 !
我想知道发生了什么,如果我做出的改变是真实的解决方案.
有什么想法吗 ?谢谢.
这是一个PHP版本的问题.你需要至少PHP 5.5.
这是因为ProxyGenerator
使用static class
关键字进行类名解析.
因此,将您的Wamp服务器更新为PHP> 5.5并且您应该好好去!
资料来源:https: //secure.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class
您可以运行composer update
以重新安装与PHP版本兼容的供应商库版本.