Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fatal error: Call to undefined function mysqli_connect()

Tags:

php

mysqli

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?

like image 625
Emi Avatar asked Aug 13 '14 08:08

Emi


1 Answers

Simply do it

sudo apt install php-mysqli

It works perfectly and it is version independent

like image 178
João Pimentel Ferreira Avatar answered Oct 12 '22 14:10

João Pimentel Ferreira