开发者

Problems loading Zends Session in bootstrap

开发者 https://www.devze.com 2023-01-30 09:57 出处:网络
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 on

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开发者_如何学JAVA( 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?


  • Did you create the table in MySQL?
  • your user have insert/update/delete privileges on the table
  • do your php setups output errors, what environment are your running production/development

I think the code should probably output some error but if your disabled the output of those you cannot see them.

0

精彩评论

暂无评论...
验证码 换一张
取 消