Reputation: 21
I am trying to enable MySQLi, and it doesn't seem to be working. When I originally tested my code it came out with an error message that said "Fatal error: Class 'mysqli' not found in C:\Apache24\htdocs\Login-system\sql\sql_import.php on 7". I looked online to see what it meant and released that I needed to enable MySQLi.
I have removed the comment on the extension=php_mysqli.dll line in the php.ini file, this was recommended to me on multiple sites. I still get the same error message.
I have added in the code I am using below;
$host = 'localhost';
$user = 'root';
$password = 'The sloth19';
$mysqli = new mysqli($host,$user,$password);
if ($mysqli->connect_errno) {
printf("Connection failed: %s\n", $mysqli->connect_error);
die();
}
if ( !$mysqli->query('CREATE DATABASE accounts') ) {
printf("Errormessage: %s\n", $mysqli->error);
}
Thanks in advance.
Upvotes: 0
Views: 613
Reputation: 1477
In addition to uncommenting the php_mysqli.dll
extension in php.ini
, also uncomment the extension_dir
directive in php.ini
and specify your location:
In my case , I must set
extension_dir = "C:\xampp\php\ext"
and restart your apache24.
Upvotes: 1