Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)

I just changed my server and experience these errors below:

Fatal error: Call to undefined function mysqli_init() in /home/blacktwitter/public_html/system/database/drivers/mysqli/mysqli_driver.php on line 126

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/blacktwitter/public_html/system/database/drivers/mysqli/mysqli_driver.php:126)

Filename: core/Common.php

Line Number: 564

Backtrace:

A PHP Error was encountered

Severity: Error

Message: Call to undefined function mysqli_init()

Filename: mysqli/mysqli_driver.php

Line Number: 126

Backtrace:

Website is in Codeigniter. It works on one of the server very well and on the local machine too. But when I am uploading to that website at the new server I have that errors. Of course, I have changed important parameters like database connection, base_url() etc.

I was sceptical about the database, but I had created a new database and user etc. and changed the connection info.

Why does this happen? It will be helpful for me to know if it is a bug at the server or at the website. Also when I am creating some index.html with some test code everything is fine.

2 Answers

0 votes
by (12.7k points)
edited by

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

Head over to your PHP init and then you uncomment the below code:

extension=php_mysqli.dll

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

Try installing php5-mysqlnd.

If you can't do it by hosting restrictions then simply move to MySQL driver (won't have to change the other configurations or queries in the CodeIgniter or anything else...)

Like this (at your config file)

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

Interested in SQL ? Check out this SQL Certification by Intellipaat. 

0 votes
ago by (2.8k points)

It isn't a flaw in your application ,rather it's just a missing driver, so you have few options.

Navigate to your PHP initialization file and uncomment the following line:

extension=php_mysqli.dll.


If that doesn't work, consider installing it on your server, as the method can differ based on the distribution you are using.

Try installing php5-mysqlnd.

If hosting limitations prevent you from doing so, you can simply switch to the MySQL driver (which won't require any changes to your other configurations or queries within CodeIgniter or anything else...).

Adjust your configuration file like this:

$db['default']['dbdriver'] = 'mysql'; (you might currently be using mysqli).

Related questions

0 votes
2 answers
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...