Fatal error: Call to undefined function mysqli_connect()

Emi picture Emi · Aug 13, 2014 · Viewed 191.8k times · Source

For 2 days now I'm trying to solve this, but unfortunately no result. Let me tell you my story about the problem. I've bulid an application on a site, and the application deals with the reviews. But, I'm trying to put it on another site, and I copyed the php files, the sql file from the old site, and moved them to the new site (they are on different FTP servers). When I'm trying to go to the pages from the application, I receive this FATAL ERROR:

Fatal error: Call to undefined function mysqli_connect()

The code that I wrote to connect to the database is this (with hidden credentials):

$con = mysqli_connect("","*the_name*","*the_pass*","*the_database*");
if (mysqli_connect_errno()) {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

Why do I get the error? It works on the old server, and the code I think it's not the problem, because it works on localhost, and on the new server it doesn't. Can anyone help me?

Answer

Dave O'Dwyer picture Dave O'Dwyer · Aug 13, 2014

If you host the server yourself, in the php.ini file remove the semicolon in front of the extension extension=php_mysqli.dll