I'm using php 8.2. When I try to connect to my mysql db using php it gives out the following error: Fatal error: Uncaught Error: Class "mysqli" not found
. I tried a lot of solutions online but none worked. I'm using the php server on Windows from the vs code extention named PHP Server. I have php_mysqli.dll installed And I'm connecting with the following code.
<?php
$username = "username";
$password = "password";
$host = "localhost";
$conn = new mysqli($host, $username, $password);
if ($conn->connect_error){
die("Connection failed: " . $conn->connect_error);
}
echo "Connected Successfully!";
?>
I also tried enabling the mysqli extension in the php.ini file by the following lines. Php was installed in the C:/myphp folder.
extension_dir = "C:/myphp/ext"
extension=C:/myphp/ext/php_mysql.dll
extension=C:/myphp/ext/php_mysqli.dll
I would appreciate any help.