我在symfony2中有一个程序,我有一个带有Cpanel的apache服务器
该项目在本地运行良好,但当我将其上传到服务器上时,会出现以下错误:
Whoops, looks like something went wrong.
1/1 ServiceNotFoundException: The service "security.firewall.map.context.secured_area" has a dependency on a non-existent service "authentication_handler".
in /home/doobin/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php line 59
at CheckExceptionOnInvalidReferenceBehaviorPass->processReferences(array(object(Reference), object(Reference), object(Definition), object(Definition), 'secured_area', object(Reference), object(Definition), array('check_path' => '/user/login_check', 'use_forward' => false, 'username_parameter' => '_username', 'password_parameter' => '_password', 'csrf_parameter' => '_csrf_token', 'intention' => 'authenticate', 'post_only' => true), object(Reference), object(Reference))) in /home/doobin/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php line 43
at CheckExceptionOnInvalidReferenceBehaviorPass->processDefinition(object(Definition)) in /home/doobin/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php line 54
at CheckExceptionOnInvalidReferenceBehaviorPass->processReferences(array(object(Definition), object(Definition), object(Definition), object(Definition), object(Definition), object(Definition), object(Definition))) in /home/doobin/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php line 52
at CheckExceptionOnInvalidReferenceBehaviorPass->processReferences(array(array(object(Definition), object(Definition), object(Definition), object(Definition), object(Definition), object(Definition), object(Definition)), object(Definition))) in /home/doobin/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php line 43
at CheckExceptionOnInvalidReferenceBehaviorPass->processDefinition(object(Definition)) in /home/doobin/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php line 37
at CheckExceptionOnInvalidReferenceBehaviorPass->process(object(ContainerBuilder)) in /home/doobin/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php line 119
at Compiler->compile(object(ContainerBuilder)) in /home/doobin/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php line 453
at ContainerBuilder->compile() in /home/doobin/app/bootstrap.php.cache line 950
at Kernel->buildContainer() in /home/doobin/app/bootstrap.php.cache line 859
at Kernel->initializeContainer() in /home/doobin/app/bootstrap.php.cache line 571
at Kernel->boot() in /home/doobin/app/bootstrap.php.cache line 614
at Kernel->handle(object(Request)) in /home/doobin/public_html/app_dev.php line 28我不知道该怎么做?\我已经给予了正确的权限来缓存和记录目录,并编辑了本地IP的配置,但是没有错误的改变!
任何帮助都会得到认可。
发布于 2013-12-04 09:35:00
这意味着它找不到您的身份验证服务。
阅读这篇文章,这可能会帮助您清理security.yml。
就像你提到的那样;
您需要像这样的身份验证处理程序services.yml。
services:
authentication_handler:
class: Acme\TestBundle\Handler\AuthenticationHandler
calls:
- [ setContainer, [ @service_container ] ] 编写security.yml的正确方法是;
security:
firewalls:
admin_area:
form_login:
success_handler: authentication_handler在将项目上传到服务器之前,先清除dev缓存并测试dev(web/app_dev.php)。
然后转移到生产,并清除它的驱动-缓存和测试。如果您对服务器进行了适当的本地测试(web/app.php),那么您将不会在服务器中遇到这些错误。
希望这能有所帮助。干杯!
发布于 2013-12-04 07:19:58
$ app/console container:debug | grep authentication_handler如果结果为空,则尚未配置服务
https://stackoverflow.com/questions/20369251
复制相似问题