0

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?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
mmenafra
  • 110
  • 5
  • @user542851: Did you try on a different server with all the error show i.e. `error_reporting(E_ALL);` – RageZ Dec 15 '10 at 03:28

1 Answers1

0
  • 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.

RageZ
  • 26,800
  • 12
  • 67
  • 76
  • Ok, I created the table as following the guide, tried myisam and a innodb table, and also all grants are available as am testing with my root access. Am testing this on my local environment. Is there anything special apart from having my php error log active? Also if I could know where exactly in my boostrap does the code have to been embeded would also be useful for testing. I'll run it again today and posst whatever appears on my apache and hp logs.Thanks – mmenafra Dec 16 '10 at 13:23
  • depending on your bootstrap and application settings the error might not display, make sure you are in "development" environment – RageZ Dec 17 '10 at 01:03