Home  >  Q&A  >  body text

How to solve "Fatal error: Class 'MySQLi' not found"?

<p>I was doing a tutorial and got this error: </p> <blockquote> <p>Fatal error: Class 'MySQLi' not found (long URL) on line 8</p> </blockquote> <p>The code on line 8 is: </p> <pre class="brush:php;toolbar:false;">$mysqli = new MySQLi($db_server, $db_user, $db_pass, $db_name);</pre> <p>I saw online someone said to see if it was turned on in my phpinfo(), but there was nothing listed under "mysqli". </p> <p>Also, I'm running PHP version 5.2.5</p>
P粉130097898P粉130097898445 days ago431

reply all(2)I'll reply

  • P粉046387133

    P粉0463871332023-08-24 19:42:37

    You can check whether the mysqli library exists by executing the following code:

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

    reply
    0
  • P粉904191507

    P粉9041915072023-08-24 00:20:02

    Sounds like you just need to install MySQLi.

    If you think you've done this and are still having issues, please post your operating system and anything else that might help with further diagnosis.

    reply
    0
  • Cancelreply