Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Symfony1 sfGuard令牌登录在Symfony 1中不起作用_Symfony1_Sfguard - Fatal编程技术网

Symfony1 sfGuard令牌登录在Symfony 1中不起作用

Symfony1 sfGuard令牌登录在Symfony 1中不起作用,symfony1,sfguard,Symfony1,Sfguard,我在使用Symfony应用程序获取sfGuard令牌登录时遇到问题。Symfony应用程序通过WordPress插件访问。WordPress插件是裸体的,它在WP控制面板中嵌入了一个带有令牌字符串的iframe: <iframe src="/app/index.php/api/authenticate/**token**" width="100%" height="100%"> 奇怪的是,尽管我能够写入/连接到站点前端的数据库。是什么原因导致应用程序不使用database.ymlc

我在使用Symfony应用程序获取
sfGuard
令牌登录时遇到问题。Symfony应用程序通过WordPress插件访问。WordPress插件是裸体的,它在WP控制面板中嵌入了一个带有令牌字符串的
iframe

<iframe src="/app/index.php/api/authenticate/**token**" width="100%" height="100%">
奇怪的是,尽管我能够写入/连接到站点前端的数据库。是什么原因导致应用程序不使用
database.yml
config文件中设置的数据库用户名和密码

app.yml
文件:

all:
  security:
    #to auto-login to the SMS alert system from inside Wordpress admin
    token: **token**
    username: user@web.com
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/07-Databases

all:
  doctrine:
    class: sfDoctrineDatabase
    param:
      dsn:      mysql:host=localhost;dbname=db_name
      username: **username**
      password: **password**
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/05-Factories

prod:
  logger:
    class: sfAggregateLogger
    param:
      level: err
      loggers:
        sf_file_debug:
          class: sfFileLogger
          param:
            level: err
            file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log

staging:
  logger:
    class: sfAggregateLogger
    param:
      level: notice
      loggers:
        sf_file_debug:
          class: sfFileLogger
          param:
            level: notice
            file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log

test:
  storage:
    class: sfSessionTestStorage
    param:
      session_path: %SF_TEST_CACHE_DIR%/sessions

  response:
    class: sfWebResponse
    param:
      send_http_headers: false

  mailer:
    param:
      delivery_strategy: none

all:
  routing:
    class: sfPatternRouting
    param:
      generate_shortest_url:            true
      extra_parameters_as_query_string: true

  view_cache_manager:
    class: sfViewCacheManager
    param:
      cache_key_use_vary_headers: true
      cache_key_use_host_name:    true
顺便说一句,我以前从未使用过Symfony,我继承了这个网站,没有任何文档

更新
database.yml
文件:

all:
  security:
    #to auto-login to the SMS alert system from inside Wordpress admin
    token: **token**
    username: user@web.com
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/07-Databases

all:
  doctrine:
    class: sfDoctrineDatabase
    param:
      dsn:      mysql:host=localhost;dbname=db_name
      username: **username**
      password: **password**
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/05-Factories

prod:
  logger:
    class: sfAggregateLogger
    param:
      level: err
      loggers:
        sf_file_debug:
          class: sfFileLogger
          param:
            level: err
            file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log

staging:
  logger:
    class: sfAggregateLogger
    param:
      level: notice
      loggers:
        sf_file_debug:
          class: sfFileLogger
          param:
            level: notice
            file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log

test:
  storage:
    class: sfSessionTestStorage
    param:
      session_path: %SF_TEST_CACHE_DIR%/sessions

  response:
    class: sfWebResponse
    param:
      send_http_headers: false

  mailer:
    param:
      delivery_strategy: none

all:
  routing:
    class: sfPatternRouting
    param:
      generate_shortest_url:            true
      extra_parameters_as_query_string: true

  view_cache_manager:
    class: sfViewCacheManager
    param:
      cache_key_use_vary_headers: true
      cache_key_use_host_name:    true
第二次更新: 为了添加,我手动将
$env
变量设置为
prod
,以便在新服务器上测试
/web/index.php

factories.yml
文件:

all:
  security:
    #to auto-login to the SMS alert system from inside Wordpress admin
    token: **token**
    username: user@web.com
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/07-Databases

all:
  doctrine:
    class: sfDoctrineDatabase
    param:
      dsn:      mysql:host=localhost;dbname=db_name
      username: **username**
      password: **password**
# You can find more information about this file on the symfony website:
# http://www.symfony-project.org/reference/1_4/en/05-Factories

prod:
  logger:
    class: sfAggregateLogger
    param:
      level: err
      loggers:
        sf_file_debug:
          class: sfFileLogger
          param:
            level: err
            file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log

staging:
  logger:
    class: sfAggregateLogger
    param:
      level: notice
      loggers:
        sf_file_debug:
          class: sfFileLogger
          param:
            level: notice
            file: %SF_LOG_DIR%/%SF_APP%_%SF_ENVIRONMENT%.log

test:
  storage:
    class: sfSessionTestStorage
    param:
      session_path: %SF_TEST_CACHE_DIR%/sessions

  response:
    class: sfWebResponse
    param:
      send_http_headers: false

  mailer:
    param:
      delivery_strategy: none

all:
  routing:
    class: sfPatternRouting
    param:
      generate_shortest_url:            true
      extra_parameters_as_query_string: true

  view_cache_manager:
    class: sfViewCacheManager
    param:
      cache_key_use_vary_headers: true
      cache_key_use_host_name:    true

让它工作起来。指针的所有功劳都归于@j0k

在新服务器上安装期间,我遇到了一些会话存储错误,因此我将
[app]/config/factories.yml
上的存储类类型更改为
sfNoStorage
。还原回
sfPDOSessionStorage
允许令牌登录工作

all:
  storage:
    #http://www.designdisclosure.com/2009/11/symfony-doctrine-database-session-storage/
    class: sfPDOSessionStorage
    param:
      session_name: ugro
      database: doctrine
      db_table: session
      db_id_col: sess_id
      db_data_col: sess_data
      db_time_col: sess_time

显示
config/databases.yml
文件。刚刚更新!感谢您的帮助,您在
apps/[yourapp]/config/factories.yml
中有什么?我看不到任何使用
sfPDOSessionStorage
来管理会话的情况。您的错误似乎来自于factories.yml中正常定义的这个类。您是否有用于此symfony实例的其他应用程序?像后端或watherver,可以使用
sfPDOSessionStorage
作为会话存储?搜索你的项目。