Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Friday, August 26, 2016

Fatal error: Call to undefined function mysqli_connect()

Fatal error: Call to undefined function mysqli_connect()


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 by Satish Sharma for Fatal error: Call to undefined function mysqli_connect()


The mysqli PHP extension is not installed on your new server.

Contact to your server administrator.

Answer by Hudixt for Fatal error: Call to undefined function mysqli_connect()


There is no error in the, but the mysqli PHP extension is not installed on your machine. Please contact your service provider to fix this issue.

Answer by Dave O'Dwyer for Fatal error: Call to undefined function mysqli_connect()


If you host the server yourself, the extension extension=php_mysqli.dll can be enabled by removing the semicolon ';' at the beginning of the extension name from the php.ini file.

Answer by Zoran for Fatal error: Call to undefined function mysqli_connect()


For CentOS, do:

sudo yum install php-mysqli  

Answer by AaronDanielson for Fatal error: Call to undefined function mysqli_connect()


If you host the server yourself, and that server happens to be Apache, you can also get this error even if you have uncommented extension=php_mysqli.dll in php.ini.

You also need to tell Apache where to find php.ini by using the PHPIniDir directive in Apache's httpd.conf

AddHandler application/x-httpd-php .php  PHPIniDir ""  

Answer by rsharpy for Fatal error: Call to undefined function mysqli_connect()


On Ubuntu I had to install php5 mysql extension.

apt-get install php5-mysql


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.