Php Symfony 2.8.1安装后的错误

Php Symfony 2.8.1安装后的错误,php,symfony,Php,Symfony,我使用的是Symfony 2.8.1和windows8以及WAMP服务器2、apache2.4.2和PHP5.4.3 我已使用命令工具成功安装了Symfony,但当我尝试访问url时,我收到以下错误消息: ProxyGenerator.php第62行中的FatalErrorException:解析错误:语法错误,意外的“类”(T_类),需要标识符(T_字符串) 然后列出以下错误: in ProxyGenerator.php line 62 at DebugClassLoader->load

我使用的是Symfony 2.8.1windows8以及WAMP服务器2apache2.4.2和PHP5.4.3 我已使用命令工具成功安装了Symfony,但当我尝试访问url时,我收到以下错误消息:

ProxyGenerator.php第62行中的FatalErrorException:解析错误:语法错误,意外的“类”(T_类),需要标识符(T_字符串)

然后列出以下错误:

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版本问题。您至少需要PHP5.5

这是因为
ProxyGenerator
使用静态
class
关键字来解析类名

因此,将您的Wamp服务器更新到PHP>5.5的位置,您应该可以开始了

资料来源:

Symfony 2.8与PHP 5.3.9或更高版本兼容。但是,Symfony使用的一个外部库(称为Doctrine)需要PHP5.5或更高版本


目前唯一的解决方案是更新PHP安装。在下一个Symfony 2.8.x版本中,可以通过限制条令库使用的版本来解决此问题。

您可以运行
composer update
重新安装与PHP版本兼容的供应商库版本。

class
是保留关键字。lexer就是这样对待它的(
T_CLASS
token)。
关键字出现时应后跟类名,而不应后跟作用域解析运算符(
Proxy::
后面应该跟一个常量名或静态变量名,而不是类标记。实际上,S2.8在PHP5.3上可以正常运行。我认为用户可能试图更新条令或做其他奇怪的事情。事实上,我怀疑他们可能真的安装了S3。太好了!谢谢,就是这样!运行
composer update
就足够了,它将安装与PHP5.4兼容的新版本
doctrine/common
(该软件包的1.6版本需要PHP5.5)。@xabbuh是的,但这是一个糟糕的解决方案。Symfony提供的包应该与声明的最低依赖项兼容(与PHP5.3兼容)。如果有人想要更高的依赖性,他们可以随时更新Composer deps。这是正确的答案。Symfony在安装时提供的供应商构建在SensioLabs的服务器上,因此它们可能运行在PHP5.5上。如果您在安装Symfony后立即手动运行正确的“composer update”,composer将自动删除不兼容的软件包并安装与您的平台兼容的版本。