别名“ScnSocialAuth_ZendSessionManager"已请求但未找到服务 [英] An alias "ScnSocialAuth_ZendSessionManager" was requested but no service could be found
问题描述
我正在尝试将 ScnSocialAuth_ZendSessionManager 安装到我的 zend 2 应用程序中.当我尝试转到登录或注册页面时收到以下错误消息:
I am trying to install ScnSocialAuth_ZendSessionManager into my zend 2 application. i am getting the following error message when i try to go to the login or registration page:
An alias "ScnSocialAuth_ZendSessionManager" was requested but no service could be found.
我已按照此处的说明进行操作:
并上传.
我然后安装
./vendor/socalnick/scn-social-auth/config/scn-social-auth.global.php.dist
/vendor/socalnick/scn-social-auth/config/scn-social-auth.local.php.dist
到我的配置.
然后在 scn-social-auth.global.php 中我做了以下事情:
Then within the scn-social-auth.global.php i did the following:
$settings = array(
'zend_db_adapter' => 'Zend\Db\Adapter\Adapter',
'zend_session_manager' => 'Zend\Session\SessionManager'
}
);
return array(
'scn-social-auth' => $settings,
'service_manager' => array(
'aliases' => array(
'ScnSocialAuth_ZendDbAdapter' => (isset($settings['zend_db_adapter'])) ? $settings['zend_db_adapter']: 'Zend\Db\Adapter\Adapter',
'ScnSocialAuth_ZendSessionManager' => (isset($settings['zend_session_manager'])) ? $settings['zend_session_manager']: 'Zend\Session\SessionManager',
),
),
);
我还创建了一个 ./config/autoload/session.local.php:
i also created a ./config/autoload/session.local.php:
<?php
return array(
'service_manager' => array(
'invokables' => array(
'Zend\Session\SessionManager' => 'Zend\Session\SessionManager',
),
),
);
所以,我不清楚为什么我仍然收到错误消息;
so, i am unclear why i am still getting the error message;
真的会对此提出任何建议.
would really appriciate any advise on this.
更新
我也将模块添加到了composer:
i also added the module to composer:
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.*",
"socalnick/scn-social-auth": "1.*"
}
升级Wilt 询问了当我 var_dump 配置值时返回什么值.返回值是:
UPATE Wilt has asked what values are returned when i var_dump the config values. the returned values are:
array (size=3)
'ScnSocialAuth_ZendDbAdapter' => string 'Zend\Db\Adapter\Adapter' (length=23)
'ScnSocialAuth_ZendSessionManager' => string 'Zend\Session\SessionManager' (length=27)
'zfcuser_zend_db_adapter' => string 'Zend\Db\Adapter\Adapter' (length=23)
您将观察到 ScnSocialAuth_ZendSessionManager 是 zend 会话管理器的别名.
you will observe that the ScnSocialAuth_ZendSessionManager is aliasing the zend sesssion manager.
所以,我不清楚为什么它说找不到服务.
so, i am unclear why it say that the service cannot be found.
真的会对此提出一些建议.
would really appriciate some advice on this.
推荐答案
您需要 scn-social-auth.global.php
和 scn-social-auth.local.php
到您的应用程序配置文件夹并设置所需的所有配置参数.
You need the scn-social-auth.global.php
and the scn-social-auth.local.php
to you application config folder and set all the config parameters that are required.
在此文件中,您可以找到 键'ScnSocialAuth_ZendSessionManager'
.您的问题可能与一些与这些配置文件相关的配置问题有关.
In this file you find the key 'ScnSocialAuth_ZendSessionManager'
. Your issue is probably related to some configuration problem related to these config files.
既然你说你加载了它们,我会说你的自动加载设置有问题.
Since you said you loaded them I would says something is wrong with your autoload setup.
您的 ZF2 应用程序是否具有正确的系统配置:
Does your ZF2 application have the proper system configuration:
'module_listener_options' => array(
'module_paths' => array(
'./module',
'./vendor',
),
'config_glob_paths' => array(
'config/autoload/{{,*.}global,{,*.}local}.php',
)
)
检查一次合并的 $config
数组是否包含所有键?
Check once if your merged $config
array contains all your keys?
$config = $serviceManager->get('Config');
这篇关于别名“ScnSocialAuth_ZendSessionManager"已请求但未找到服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!