简体   繁体   中英

Can't Load Drivers In Code Igniter

I always get an uncaught exception when I run my application.

I got error like this :

An uncaught Exception was encountered

Type: UnexpectedValueException

Message: Session: Configured driver 'files' was not found. Aborting.

Filename: C:\xampp\htdocs\simatur\system\libraries\Session\Session.php

Line Number: 233

Backtrace:

File: C:\xampp\htdocs\simatur\application\third_party\HMVC\Loader.php
Line: 138
Function: library

File: C:\xampp\htdocs\simatur\application\third_party\HMVC\Loader.php
Line: 115
Function: library

File: C:\xampp\htdocs\simatur\application\controllers\Welcome.php
Line: 23
Function: __construct

File: C:\xampp\htdocs\simatur\index.php
Line: 317
Function: require_once

Can anyone help me how to fix this?

This is my autoload.php and config.php :

$autoload['packages'] = array();
$autoload['libraries'] = array('database', 'session', 'authentification', 'rpdb');
$autoload['drivers'] = array();
$autoload['helper'] = array('url', 'general', 'general_db');
$autoload['config'] = array();
$autoload['language'] = array();
$autoload['model'] = array(/*"Generalmodel" => "gm"*/);

and this :

$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;

I already try everything that I found in the internet, but it always gave me same error like above.

Please anyone help me how to deal with this problem.

Thank you...

Old But Good Tutorial HMVC

You are using HMVC you have your controllers in the wrong folder you need to make a modules folder. Just the class names and file names need to only have the first letter upper case.

application

application > modules > example

application > modules > example > controllers > Welcome.php

Then

<?php 

class Welcome extends MX_Controller {

   public function index() {
      echo "hello";
   }

}

Url Example

http://localhost/yourproject/index.php/example/welcome

https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc

You may get a load error you may need this

https://pastebin.com/vNUhJCss

As you want to load driver you should mention it in autoload.php . So change $autoload['drivers'] = array(); to

$autoload['drivers'] = array('session');

Also remove session from libraries like $autoload['libraries'] = array('database', 'authentification', 'rpdb');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM