在 bootstrap 中加载 Zends Session 时出现问题
我无法让 Zend 将我的会话存储在 MySQL 表中。我已经一步步遵循 Zend Framework 指南,并且不确定是否将代码放入我的引导文件中,但是一旦代码片段就位并且我加载了我的站点,Apache 就会崩溃。字面意义上的崩溃。我的日志什么也没说。
这是我的代码:
$db = Zend_Db::factory( 'Pdo_Mysql', array(
'host' => 'localhost',
'username' => 'root',
'password' => '*****',
'dbname' => 'drecords'
));
Zend_Db_Table_Abstract::setDefaultAdapter( $db );
$config = array(
'name' => 'sessions',
'primary' => 'id',
'modifiedColumn' => 'modified',
'dataColumn' => 'data',
'lifetimeColumn' => 'lifetime'
);
Zend_Session::setSaveHandler( new Zend_Session_SaveHandler_DbTable( $config ) );
//start your session!
Zend_Session::start();
我在 Bootstrap 文件末尾立即运行此代码。
我的问题是,如果我遵循 Zends 文档,我做错了什么?是否有一些我需要了解的信息,例如 MySQL 或 PHP.ini 中我不知道的额外配置选项?
I am having trouble getting Zend to store my session in MySQL table. I have followed the Zend Framework guide step by step, and am not sure if is where am putting the code in my bootstrap file, but once the code snippet is in place and I load my site Apache just crashes. Literally crashes. My logs don't say anyhing.
Here is my code:
$db = Zend_Db::factory( 'Pdo_Mysql', array(
'host' => 'localhost',
'username' => 'root',
'password' => '*****',
'dbname' => 'drecords'
));
Zend_Db_Table_Abstract::setDefaultAdapter( $db );
$config = array(
'name' => 'sessions',
'primary' => 'id',
'modifiedColumn' => 'modified',
'dataColumn' => 'data',
'lifetimeColumn' => 'lifetime'
);
Zend_Session::setSaveHandler( new Zend_Session_SaveHandler_DbTable( $config ) );
//start your session!
Zend_Session::start();
I am running this code right after at the end of my Bootstrap file.
My question is what am I doing wrong if am following Zends documentation? Is there something I need to know like an extra configuration option in my MySQL or PHP.ini that am not aware of?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为代码可能应该输出一些错误,但如果你禁用了这些错误的输出,你就看不到它们。
I think the code should probably output some error but if your disabled the output of those you cannot see them.