致命的なエラー: C:\wamp\www\hol\library\Zend\Db\Table\Abstract.php の 755 行目に「Zend_Session_SaveHandler_DbTable のアダプタが見つかりません」というメッセージが表示された例外 'Zend_Db_Table_Exception' が捕捉されませんでした ( ! ) Zend_Db_Table_Exception: No adapter found for C:\wamp\www\hol\library\Zend\Db\Table\Abstract.php の Zend_Session_SaveHandler_DbTable 755 行目のコール スタック
時刻メモリ機能の場所 1 0.0005 373664 {main}( ) ..\init.php:0
2 0.0325 2749720 Zend_Session_SaveHandler_DbTable->__construct() ..\init.php:40 3 0.0325 2750168 Zend_Db_Table_Abstract->__construct( ) ..\DbTable.php:207 4 0.0325 2750480 Zend_Session_SaveHandler.phpAtract.set\ 268 5 0.0325 2750480 Zend_Db_Table_Abstract->_setup( ) ..\DbTable.php:403 6 0.0325 2750480 Zend_Db_Table_Abstract->_setupDatabaseAdapter( ) ..\Abstract.php:739
コード:
//Configuration consumption
$config = new Zend_Config(require 'config.php');
//Database configuration
$db = Zend_Db::factory($config->database->adapter, array(
'host' => $config->database->params->host,
'username' => $config->database->params->username,
'password' => $config->database->params->password,
'dbname' => $config->database->params->dbname
));
$sess_config = array(
'name' => 'session',
'primary' => array(
'session_id',
'save_path',
'name',
),
'primaryAssignment' => array(
'sessionId',
'sessionSavePath',
'sessionName',
),
'modifiedColumn' => 'modified',
'dataColumn' => 'session_data',
'lifetimeColumn' => 'lifetime',
);
Zend_Session::setSaveHandler(new Zend_Session_SaveHandler_DbTable($sess_config));
//Initialize the session
Zend_Session::start();
構成
<?php
// config.php
return array(
'database' => array(
'adapter' => 'Pdo_Mysql',
'params' => array(
'host' => 'localhost',
'username' => 'root',
'password' => '',
'dbname' => 'hol'
)
),
'session' => array(
'name' => 'session',
'primary' => array(
'session_id',
'save_path',
'name',
),
'primaryAssignment' => array(
'sessionId',
'sessionSavePath',
'sessionName',
),
'modifiedColumn' => 'modified',
'dataColumn' => 'session_data',
'lifetimeColumn' => 'lifetime'
)
);
SQL:
CREATE TABLE `session` (
`session_id` char(32) NOT NULL,
`save_path` varchar(32) NOT NULL,
`name` varchar(32) NOT NULL DEFAULT '',
`modified` int,
`lifetime` int,
`session_data` text,
PRIMARY KEY (`Session_ID`, `save_path`, `name`)
);