Codeigniter: fatal error call to undefined function mysqli_init() Codeigniter: fatal error call to undefined function mysqli_init() codeigniter codeigniter

Codeigniter: fatal error call to undefined function mysqli_init()


It is not a bug in your application, it is just a missing driver, so, you have couple of options...

Go to your php init and uncomment the following:

extension=php_mysqli.dll

If not, try installing it at your server, it varies depending on your distribution.

Try installing php5-mysqlnd

If you cannot do it by hosting restrictions then just move to mysql driver (wont need to change other configurations or queries in CodeIgniter or anything else...)

like this (at your config file)

$db['default']['dbdriver'] = 'mysql'; (you might have mysqli now)


I just had this issue on a ubuntu16.04, php7.1 install with Codeigniter 3.

Solution was simple (if hard to find!)

sudo apt-get install php7.0-mysql

I realised that the mysql*.ini files where missing from the etc/php/7.1/mods-available directory. Not sure how it happened, but that worked for me.

If you use 7.2, simply type sudo apt-get install php7.2-mysql


Use this:

sudo apt-get install php7.*-mysqli

or

sudo phpenmod mysqlisudo service apache2 restart