. Advertisement .
..3..
. Advertisement .
..4..
I don’t know what I’m doing wrong, but I’ve already lost a couple of days struggling with this. Here is my command line:
$con = mysqli_connect("","*the_name*","*the_pass*","*the_database*");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
This returns:
Fatal error: Call to undefined function mysqli_connect()
I don’t have any experience with the “call to undefined function mysqli_connect()”. In this case, how should I change?
The cause:
There are some changes made on the server and the mysqli extension is affected by them. In addition, php extension isn’t being used by default. And the error occured due to these reasons.
Solution:
When the error occurs, first you need to check whether the PHP MySQL extension module is being loaded or not. On Windows, you can open extension=php_mysqli.dll by removing the semicolon ‘;’ at the beginning of the php.ini file’s extension name.
Then in your php.ini file, let’s replace:
by
If this error still logs, lett’s add a path for this dll file as following:
php_mysqli.dll
andphp_pdo_mysql.dll
are similar.Finally, let’s save and run your code again, your error will be solved.
Do it!
sudo apt install php-mysqli
It works flawlessly and is independent of any version