簡體   English   中英

FOS UserBundle:致命錯誤:無法重新聲明類FormAuthenticationEntryPoint

[英]FOS UserBundle : Fatal error: Cannot redeclare class FormAuthenticationEntryPoint

我是Symfony2的新手,我使用FOS User bundle創建了一個新項目。

嘗試登錄或注冊時出現此錯誤:

網址: http://symfony.local/login_check

Fatal error: Cannot redeclare class Symfony\Component\Security\Http\EntryPoint\FormAuthenticationEntryPoint 

在網上瀏覽了幾個小時之后,我完全迷失了。

有沒有人可以幫助我?

login_check不是登錄頁面,而是執行登錄檢查腳本的路由,您是否檢查了security.yml文件是否具有適當的防火牆和提供程序等? 您需要具有以下內容:

security:
 providers:
        in_memory:
            memory: ~
        fos_userbundle:
            id: fos_user.user_provider.username_email
 firewalls:
        dev:
            pattern:  ^/(_(profiler|wdt)|css|images|js)/
            security: false

        main:
          pattern: .*
          context: user
          form_login:
              success_handler: authentication_handler
              failure_handler: authentication_handler
              provider:       fos_userbundle
              csrf_provider:  form.csrf_provider
              login_path:     /user/login
              check_path:     /user/login_check
              default_target_path: /user/dashboard
              always_use_default_target_path: true
          logout:
              path:   /user/logout
              target: /
          anonymous: true
    #fos security configurations
    encoders:
        FOS\UserBundle\Model\UserInterface: sha512

    role_hierarchy:
        ROLE_SUPER_ADMIN: [ ROLE_USER, ROLE_ADMIN, ROLE_SONATA_ADMIN, ROLE_ADMINROLE_ALLOWED_TO_SWITCH ]

    access_control:
        - { path: ^/user/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/user/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/user/register, roles: [ ROLE_SUPER_ADMIN ] }
        - { path: ^/user, roles: [ ROLE_USER, ROLE_SUPER_ADMIN ] }
        - { path: ^/.*, role: IS_AUTHENTICATED_ANONYMOUSLY }

    acl:
        connection: default

花了幾個小時弄清楚之后,我發現問題是由於啟用了APC引起的。

只需將其關閉,問題就會消失。

我的配置:

  • Windows 7(用於開發)
  • 阿帕奇2.4.7
  • PHP 5.3.29
  • APC版本3.1。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM