Home  >  Q&A  >  body text

How to resolve "Class 'MySQLi' not found" fatal error

<p>I was working on a tutorial and encountered this error:</p> <blockquote> <p>Fatal error: Class 'MySQLi' not found (long URL) at 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 someone online saying to check whether it is turned on in phpinfo(), but there is nothing under "mysqli". </p> <p>Also, I'm running PHP version 5.2.5</p>
P粉393030917P粉393030917425 days ago439

reply all(2)I'll reply

  • P粉022723606

    P粉0227236062023-08-22 13:05:21

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

    if (!function_exists('mysqli_init') && !extension_loaded('mysqli')) {
        echo '我们没有mysqli!!!';
    } else {
        echo '太好了,我们有它!';
    }

    reply
    0
  • P粉805931281

    P粉8059312812023-08-22 11:56:07

    Sounds like you just need to install MySQLi.

    If you think you've done this and are still having problems, please post your operating system and other information that may help with further diagnosis.

    reply
    0
  • Cancelreply