My question is just similar to this question but I am using PHP version 7.4.1 in Windows 7 [32bit].
<?php
if(!function_exists('mysqli_init') && !extension_loaded('mysqli')){
echo 'We dont have mysqli';
}
else{
echo'Yes';
}
mysqli_connect('localhost', "root", "", "akash");
?>
It returns:
We dont have mysqli
Fatal error: Uncaught Error: Call to undefinedfunction mysqli_connect()
What I have tried:
As I have seen various answers on this problem and all the answers is simply based on the php.inf file but in my php directory there is no file of this name and so after looking on how to install this I couldn’t really find a way, after visiting http://php.net/manual/en/mysqli.installation.php, I scrolled down to find the "PHP 5.3.0 and newer" section where it says I wouldn’t need to worry about installing it.
2
Answers
First you need to have a
php.ini
somewhere.Usually in the directory with php you have two files
php.ini-development
andphp.ini-production
– they are examples ofphp.ini
with some recommended settings.Copy
php.ini-development
intophp.ini
and place it somewhere.Find the line
and uncomment it (remove the semicolon from the beggining)
php.ini
is placed not wherephp.exe
is, then pass the path to it in the command line after-c
option:If you host the server yourself, in the php.ini file remove the semicolon in front of the extension extension=php_mysqli.dll