当前位置:  开发笔记 > 编程语言 > 正文

安装后Symfony 2.8.1错误

如何解决《安装后Symfony2.8.1错误》经验,为你挑选了2个好方法。

我正在使用Symfony 2.8.1并使用WAMP Server 2,Apache 2.4.2和PHP 5.4.3Windows 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'

有用 !

我想知道发生了什么,如果我做出的改变是真实的解决方案.

有什么想法吗 ?谢谢.



1> tchap..:

这是一个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


实际上,S2.8在php 5.3上运行正常.我认为用户可能试图更新Doctrine或做一些其他奇怪的事情.事实上,我怀疑他们实际上可能已经安装了S3.

2> 小智..:

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

推荐阅读
赛亚兔备_393
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有