首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >网站不在使用symfony 2的服务器上运行

网站不在使用symfony 2的服务器上运行
EN

Stack Overflow用户
提问于 2013-12-04 07:12:31
回答 2查看 512关注 0票数 0

我在symfony2中有一个程序,我有一个带有Cpanel的apache服务器

该项目在本地运行良好,但当我将其上传到服务器上时,会出现以下错误:

代码语言:javascript
复制
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的配置,但是没有错误的改变!

任何帮助都会得到认可。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-12-04 09:35:00

这意味着它找不到您的身份验证服务。

阅读这篇文章,这可能会帮助您清理security.yml。

Symfony2 Login and Security

就像你提到的那样;

您需要像这样的身份验证处理程序services.yml。

代码语言:javascript
复制
services:
    authentication_handler:
        class: Acme\TestBundle\Handler\AuthenticationHandler
        calls:
             - [ setContainer, [ @service_container ] ] 

编写security.yml的正确方法是;

代码语言:javascript
复制
security:
    firewalls:
        admin_area:
            form_login:
                success_handler: authentication_handler

在将项目上传到服务器之前,先清除dev缓存并测试dev(web/app_dev.php)。

然后转移到生产,并清除它的驱动-缓存和测试。如果您对服务器进行了适当的本地测试(web/app.php),那么您将不会在服务器中遇到这些错误。

希望这能有所帮助。干杯!

票数 1
EN

Stack Overflow用户

发布于 2013-12-04 07:19:58

代码语言:javascript
复制
$ app/console container:debug | grep authentication_handler

如果结果为空,则尚未配置服务

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20369251

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档