2014-09-02 108 views
1

我是Symfony的新手,可能這就是爲什麼我似乎無法定位某些錯誤從哪裏生成。 當我把我的網站放在生產服務器上時,彈出一個新問題,FOSUserBundle身份驗證似乎不起作用FOSUserBundle身份驗證在生產服務器上不起作用

注意:這對localhost非常有用,但只要我將它放在遠程服務器上,它不驗證任何用戶。

網/ config.php文件建議我:

1) Install and enable the php_posix extension (used to colorize the CLI output). 
    2) Install and enable the intl extension (used for validators) 
    3) Install and enable a PHP accelerator like APC (highly recommended). 
    4) Set short_open_tag to off in php.ini*. 

可在驗證這一事業的問題?

我config.yml文件

imports: 
     - { resource: parameters.yml } 
     - { resource: security.yml } 

    framework: 
     #esi:    ~ 
     translator:  { fallback: "%locale%" } 
     translator:  ~ 
     secret:   "%secret%" 
     router: 
      resource: "%kernel.root_dir%/config/routing.yml" 
      strict_requirements: ~ 
     form:   ~ 
     csrf_protection: ~ 
     validation:  { enable_annotations: true } 
     templating: 
      engines: ['twig'] 
      #assets_version: SomeVersionScheme 
     default_locale: "%locale%" 
     trusted_hosts: ~ 
     trusted_proxies: ~ 
     session: 
      # handler_id set to null will use default session handler from php.ini 
      handler_id: ~ 
     fragments:  ~ 
     http_method_override: true 

    # Twig Configuration 
    twig: 
     debug:   "%kernel.debug%" 
     strict_variables: "%kernel.debug%" 

    # Assetic Configuration 
    assetic: 
     debug:   "%kernel.debug%" 
     use_controller: false 
     bundles:  [ LesCouvertsBundle , LesRestaurantBundle , LesVirtualMarketBundle , LesShopBundle ] 
     #java: /usr/bin/java 
     filters: 
      cssrewrite: ~ 
      #closure: 
      # jar: "%kernel.root_dir%/Resources/java/compiler.jar" 
      #yui_css: 
      # jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar" 

    # Doctrine Configuration 
    doctrine: 
     dbal: 
      driver: "%database_driver%" 
      host:  "%database_host%" 
      port:  "%database_port%" 
      dbname: "%database_name%" 
      user:  "%database_user%" 
      password: "%database_password%" 
      charset: UTF8 
      # if using pdo_sqlite as your database driver, add the path in parameters.yml 
      # e.g. database_path: "%kernel.root_dir%/data/data.db3" 
      # path:  "%database_path%" 

     orm: 
      auto_generate_proxy_classes: "%kernel.debug%" 
      auto_mapping: true 

    # Swiftmailer Configuration 
    swiftmailer: 
     transport: "%mailer_transport%" 
     host:  "%mailer_host%" 
     username: "%mailer_user%" 
     password: "%mailer_password%" 
     encryption: ssl 
     auth_mode: login 
     spool:  { type: memory } 

    fos_user: 
     db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel' 
     firewall_name: main 
     user_class: Les\UserBundle\Entity\User 
     registration: 
      confirmation: 
       from_email: 
        address:  [email protected] 
        sender_name: Lescouverts Registration 
       enabled: false 
     from_email: 
      address:  [email protected] 
      sender_name: LesCouverts 

    services: 
     resto_module: 
      class:  Les\RestoModule\Module 
      arguments: [module] 
     lists_module: 
      class:  Les\RestoParam\Param 
      arguments: [parameters] 

我security.yml文件

security: 
     encoders: 
      FOS\UserBundle\Model\UserInterface: sha512 

     role_hierarchy: 
      ROLE_CLIENT:  ROLE_USER 
      ROLE_RESTO:  ROLE_CLIENT 
      ROLE_SHOP:  ROLE_CLIENT 
      ROLE_ADMIN:  [ ROLE_USER, ROLE_CLIENT, ROLE_RESTO , ROLE_SHOP ] 
      ROLE_SUPER_ADMIN: ROLE_ADMIN 

     providers: 
      fos_userbundle: 
       id: fos_user.user_provider.username 

     firewalls: 
      main: 
       pattern: ^/ 
       form_login: 
        provider: fos_userbundle 
        login_path:  fos_user_security_login 
        csrf_provider: form.csrf_provider 
    #      check_path: /login_check 
        check_path: fos_user_security_check 
        default_target_path:/
        csrf_provider: form.csrf_provider 

       logout: 
        path: fos_user_security_logout 

       anonymous: true 

     access_control: 
      - { path: ^/booking, role: ROLE_CLIENT } 
      - { path: ^/party_calendar, role: ROLE_CLIENT } 
      - { path: ^/restaurant_admin, role: ROLE_RESTO } 
      - { path: ^/shop_admin, role: ROLE_SHOP } 
      - { path: ^/virtual_market, role: [ ROLE_RESTO, ROLE_SHOP ] } 
      - { path: ^/root, role: ROLE_ADMIN } 

      - { path: ^/secure_area/login, role: IS_AUTHENTICATED_ANONYMOUSLY } 
      - { path: ^/secure_area/connect, role: IS_AUTHENTICATED_ANONYMOUSLY } 
      - { path: ^/secure_area, role: ROLE_USER } 

我不知道如何調試這個問題!

加上發展模式時,出現錯誤

 RuntimeException: Failed to write cache file  
      "/var/www/vhosts/httpdocs/app/cache/dev/classes.php". 

,所以我不能甚至可以看到,如果探查器指示任何錯誤!

+0

您是否執行了所有步驟,以生產移動例如'PHP應用程序/控制檯高速緩存:明確--env =督促--no-debug' – senK 2014-09-02 09:41:37

+0

「的RuntimeException:無法寫入緩存文件」 suggestst網頁伺服器(Apache,Nginx或其他)不能創建一個新的文件,因此確保應用程序/緩存是可寫Web服務器我都,產品和開發 – 2014-09-02 11:39:08

回答