Fatal error: Class CI_Session_files_driver contain

2019-03-01 11:53发布

问题:

Fatal error: Class CI_Session_files_driver contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::open) in C:\xampp\htdocs\cmms2\system\libraries\Session\drivers\Session_files_driver.php on line 49

this error keeps on showing up while i'm working on my localhost xampp web app projec. I'm using codeigniter by the way. What do you think is the reason this shows up? These are the only codes that I've done with session.

  $this->session->set_userdata($data);
    $autoload['libraries'] = array('database','session');
    $config['sess_driver'] = 'files';
    $config['sess_cookie_name'] = 'ci_session';
    $config['sess_expiration'] = 7200;
    $config['sess_save_path'] = sys_get_temp_dir();
    $config['sess_match_ip'] = FALSE;
    $config['sess_time_to_update'] = 300;
    $config['sess_regenerate_destroy'] = FALSE;

回答1:

Please restart apache server if not working then download CodeIgniter again and replace your system/ directory with a fresh one.



回答2:

Edit: This is a PHP bug that in my observation triggers on Windows, Apache+mod_php.

(old answer below)


SessionHandlerInterface::open() is implemented by system/libraries/Session/drivers/Session_files_driver.php in CodeIgniter.

The only way to trigger the error you've shown is by modifying that file, which you're not supposed to do.



回答3:

Go in System folder /system/libraries/Session

Then comment the code in SessionHandlerInterface.php

interface SessionHandlerInterface {

// public function open($save_path, $name);
// public function close();
// public function read($session_id);
// public function write($session_id, $session_data);
// public function destroy($session_id);
// public function gc($maxlifetime);
}

Let's try your code is working or not