Everything was working fine on localhost but when I deployed it to live i got the following error:
CRITICAL - 2022-11-20 19:29:19 --> Class 'CodeIgniter\Database\MYSQLI\Connection' not found
in SYSTEMPATH/Database/Database.php on line 136.
1 SYSTEMPATH/Database/Database.php(56): CodeIgniter\Database\Database->initDriver('MYSQLI', 'CodeIgniter\\Database\\MYSQLI\\Connection', [...])
2 SYSTEMPATH/Database/Config.php(78): CodeIgniter\Database\Database->load([...], 'default')
3 SYSTEMPATH/Model.php(137): CodeIgniter\Database\Config::connect('default')
4 SYSTEMPATH/Config/Factories.php(126): CodeIgniter\Model->__construct(null)
5 SYSTEMPATH/Config/Factories.php(83): CodeIgniter\Config\Factories::__callStatic('models', [...])
6 SYSTEMPATH/Common.php(817): CodeIgniter\Config\Factories::models('App\\Models\\UsersModel', [...], null)
7 APPPATH/Controllers/Auth.php(99): model('App\\Models\\UsersModel')
8 SYSTEMPATH/CodeIgniter.php(902): App\Controllers\Auth->createNewUser()
9 SYSTEMPATH/CodeIgniter.php(457): CodeIgniter\CodeIgniter->runController(Object(App\Controllers\Auth))
10 SYSTEMPATH/CodeIgniter.php(340): CodeIgniter\CodeIgniter->handleRequest(null, Object(Config\Cache), false)
My .env file is something like this
database.default.hostname = 'hostname.net'
database.default.database = 'database'
database.default.username = 'username'
database.default.password = 'password'
database.default.DBDriver = MYSQLI
database.default.port = 3306
I have checked and the file does actually exist under database/mysqli. The server has the following file structure:
- root
- codeigniter_framework
- app
- system
- writable
- .env
- public_html
- assets
- index.php
- .htaccess
I also have updated the index.php to contain:
require FCPATH . '../codeigniter_framework/app/Config/Paths.php';
I have also already double checked the database credentials and they are correct. Codeigniter is still in development environment as im trying to get this to work before changing it to production. Does anybody know what is going wrong?
As Anthony suggested in the comments I had to change MYSQLI to MySQLi in my .env