子域的Zend身份验证问题 [英] Zend Authentication Problem with subdomain
问题描述
我正在使用在Ubuntu上使用zend框架,php,mysql的项目.
I am working on a project using zend framework, php, mysql on ubuntu.
我已经在本地计算机上使用zend身份验证创建了主机名 test.dev .使用zend身份验证对用户进行身份验证后,我将为登录的用户ID设置会话变量.我在不同页面上使用此会话变量(userid)以确保身份验证.
I have created hostname test.dev on my local machine and using zend authentication. When an user is authenticated using zend authentication, I set session variable for logged in user id. I use this session variable(userid) on different pages to sure authentication.
问题: 现在,我必须创建一个子域.我在本地计算机上创建了一个新的主机名 mypage.test.dev .这两个主机名都指向同一目录,例如/var/www/test/public.但是,当我登录 test.dev 时,我必须再次登录子域 mypage.test.dev .甚至 test.dev 的会话变量也无法在 mypage.test.dev 上访问.
Question: Now I have to create a subdomain. I have created a new hostname mypage.test.dev on my local machine. Both hostnames are pointing to same directory, for example /var/www/test/public. But when I login on test.dev, I have to login again on subdomain mypage.test.dev. Even session variables of test.dev are not accessable on mypage.test.dev.
如何使用一次登录登录所有子域?
How can I login on all subdomains using one login?
谢谢.
推荐答案
一段时间后,我得到了解决方案.
After some time I have got my solution.
我将以下行添加到 config.ini
session.cookie_domain = .test.dev
然后将以下行添加到 Bootstrap.php
Zend_Session::setOptions( $this->getOption('session') );
和会话变量适用于test.dev的所有子域
and session variables are working for all subdomains of test.dev
这篇关于子域的Zend身份验证问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!