I have a problem to connect MySQLi
| From: | Ahmed Helmy Ahmed Abdelnaeim | Date: | Wed, 14 Feb 2024 17:42:01 +0000 |
| Subject: | I have a problem to connect MySQLi | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-328372@lists.php.net to get a copy of this message | ||
Dear,
I have installed Apache 2.4 on windows, also PHP 8.3.2, every thing is
going well except connection with MySQLi.
My code as follow
<?php
// Connection parameters
$serverName = "localhost";
$dbUserName = "root";
$dbPassword = "password";
$database = "dbname";
// Create connection $conn = new mysqli($serverName, $dbUserName,
$dbPassword, $database);
// Check connection
if (!$conn) {
die("Connection Failed: " .mysqli_connect_error());
}
However it gives me error as follow:
*"Fatal error*: Uncaught Error: Class "mysqli" not found in
C:\Apache24\htdocs\01 PHP_Traning\mySQL_01\includes\dbh_custom_inc.php:11
Stack trace: #0 {main} thrown in *C:\Apache24\htdocs\01
PHP_Traning\mySQL_01\includes\dbh_custom_inc.php* on line *11"*
Note:
The same code works in another computers.
Best Regards,
Ahmed Helmy