CodeIgniter Fix Fatal error: session_start(): Failed to initialize storage module: user (path: )

Fatal error: session_start(): Failed to initialize storage module: user (path: )

解決方法1:

開啟CodeIgniter設定檔,預設再 application/config/config.php

把:

$config['sess_save_path'] = NULL;

改成:

$config['sess_save_path'] = BASEPATH . 'yourfoldername/cache/';

解決方法2:

改用 DB session ,必須先連接資料庫,起設定好資料庫連線資訊

開啟CodeIgniter設定檔,預設再 application/config/config.php

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';

改成

$config['sess_driver'] = 'database';
$config['sess_save_path'] = 'ci_sessions';

匯入資料表

CREATE TABLE IF NOT EXISTS `ci_sessions` (
    `id` varchar(128) NOT NULL,
    `ip_address` varchar(45) NOT NULL,
    `timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
    `data` blob NOT NULL,
    KEY `ci_sessions_timestamp` (`timestamp`)
);

 

相關文章:

READ  MIS WAMP手動安裝及設定教學 Apache2.4 + PHP7 for windows10

發表迴響

這個網站採用 Akismet 服務減少垃圾留言。進一步瞭解 Akismet 如何處理網站訪客的留言資料