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?
Happens when php extensions are not being used by default. In your php.ini file, change
;extension=php_mysql.dll
to
extension=php_mysql.dll
.**If this error logs, then add path to this dll file, eg
extension=C:\Php\php-???-nts-Win32-VC11-x86\ext\php_mysql.dll
Do same for
php_mysqli.dll
andphp_pdo_mysql.dll
. Save and run your code again.The mysqli PHP extension is not installed on your new server.
Contact to your server administrator.
if you use ubuntu 16.04 (maybe and above),you have this module already but not enabled by default. Just do this:
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.
On Ubuntu I had to install php5 mysql extension.
apt-get install php5-mysql
Late to the conversation...
If you have the module installed and set your PHP.INI file properly, check your apache error log for something like the following:
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\ext\php_mysqli.dll' - The specified module could not be found.
In this case, your extension directory is not what you think it is. You may neeed to set it explicitly, like so: