I'm a new user of CodeIgniter. I use CodeIgniter 3.1.3 and been struggling with this random-timed unknown mysterious fatal error since almost 2 weeks ago:
p.s. 1) I've been use CodeIgniter for about a month. 2) There is absolutely no error in my code!! So this is a pure system error, not syntax/runtime error.
Fatal error: Class CI_Session_database_driver contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read) in C:\xampp\htdocs\pokopoko\system\libraries\Session\drivers\Session_database_driver.php on line 49
A PHP Error was encountered
Severity: Error
Message: Class CI_Session_database_driver contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (SessionHandlerInterface::read)
Filename: drivers/Session_database_driver.php
Line Number: 49
Backtrace:
Error text is not always the same! Sometimes:
Filename: drivers/Session_files_driver.php
Or
Filename: drivers/Session_database_driver.php
Or
Filename: Session/Session_driver.php
Or
Filename: core/Input.php
Or even
Filename: Unknown
This error happen at random time, when I reload my website, or even when my website still opened (idle) in browser without I doing anything, my ajax suddenly not work! This happen not only in certain browser! I'm absolutely haven't changed/modified/opened any of CodeIgniter's system files!!
I have tried:
- Restarted my apache like suggested here: CodeIgniter Database Session Error. This work but only temporary till this random-timed unknown mysterious fatal error happen again.
- Re-extract fresh downloaded CodeIgniter-3.1.3.zip to my htdocs. Move my project. Still happen!
- Reinstall my XAMPP (the latest version). This error not appear ... until few hours later, no difference with before.
Few screenshots:
What is this? What's the solution? Help me.
Update:
This is my autoload.php
& config.php
content:
my autoload.php
:
$autoload['packages'] = array();
$autoload['libraries'] = array('database','session'); //I set this
$autoload['drivers'] = array();
$autoload['helper'] = array('url','array'); //I set this
$autoload['config'] = array();
$autoload['language'] = array();
$autoload['model'] = array();
my config.php
:
$config['base_url'] = 'http://localhost/pokopoko/'; //I set this
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'REQUEST_URI';
$config['url_suffix'] = '';
$config['language'] = 'english';
$config['charset'] = 'UTF-8';
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = 'MY_';
$config['composer_autoload'] = FALSE;
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
$config['allow_get_array'] = TRUE;
$config['log_threshold'] = 0;
$config['log_path'] = '';
$config['log_file_extension'] = '';
$config['log_file_permissions'] = 0644;
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['error_views_path'] = '';
$config['cache_path'] = '';
$config['cache_query_string'] = FALSE;
$config['encryption_key'] = '';
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
$config['cookie_prefix'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = FALSE;
$config['standardize_newlines'] = FALSE;
$config['global_xss_filtering'] = FALSE;
$config['csrf_protection'] = FALSE;
$config['csrf_token_name'] = 'csrf_test_name';
$config['csrf_cookie_name'] = 'csrf_cookie_name';
$config['csrf_expire'] = 7200;
$config['csrf_regenerate'] = TRUE;
$config['csrf_exclude_uris'] = array();
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;
$config['proxy_ips'] = '';
Update #2:
I tried @Fairy Dancer's solution. Work about 1 hour, but then this error reappear (Error information changed, but still the same Session_database_driver.php on line 49
)
Update #3:
Yesterday @Rahi and I together has suspected that it maybe a bug between CodeIgniter 3 with PHP >7. There's also other developer with same environment/combination experiencing this issue, like here: https://forum.codeigniter.com/thread-66544.html. But I can't downgrade my PHP because I'm using many PHP 7 new shorthands like ??
. If this true, maybe I'll wait until there's another solution, or until CI have newer version with this bug fixed.