Re: I have a problem to connect MySQLi

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Thu, Feb 15, 2024 at 3:35 PM Ahmed Helmy Ahmed Abdelnaeim <ahmedhelmy72@xxxxxxxxx> wrote:
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
Hi Ahmed,

Looking at the folder path, I am assuming you are training. All the best with that!

Coming to the issue, it seems the mysqli extension is not enabled. 

Enable php_mysqli.dll in php.ini.

Ref: https://www.php.net/manual/en/mysqli.installation.php

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux