简体   繁体   中英

FOS UserBundle : Fatal error: Cannot redeclare class FormAuthenticationEntryPoint

New to Symfony2, I created a new project using FOS User bundle.

I get this error when I try to log in or register:

URL : http://symfony.local/login_check

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

After hours looking around on the web, I am completely lost.

Is there someone to help me?

login_check is not the login page, it is the route which executes the login check script have you checked your security.yml file to have the proper firewalls and providers etc? you need to have something like this:

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

After spending hours to figure it out, I have found that the problem is due to APC enabled...

Just turn it off and the problem disappears.

My config :

  • Windows 7 (for development)
  • Apache 2.4.7
  • PHP 5.3.29
  • APC version 3.1.?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM