Fatal error: Class 'MySQLi' not found


Question

I am doing a tutorial and am getting this error:

Fatal error: Class 'MySQLi' not found (LONG URL) on line 8

The code on line 8 is:

$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name) or die(mysqli_error());

I saw online someone said to see if it was turned on in my phpinfo(), but there wasn't anything listed in there under for "mysqli".

Also, I am running PHP version 5.2.5

1
82
2/9/2016 9:11:00 PM

Accepted Answer

Sounds like you just need to install MySQLi.

If you think you've done that and still have a problem, please post your operating system and anything else that might help diagnose it further.

77
3/6/2019 7:32:03 AM

You can check if the mysqli libraries are present by executing this code:

if (!function_exists('mysqli_init') && !extension_loaded('mysqli')) {
    echo 'We don\'t have mysqli!!!';
} else {
    echo 'Phew we have it!';
}

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon