The Wonderful World of Linux A mostly dead cpanel/linux blog

Call to undefined method mysqli_result::fetch_all()

If you have ever experienced this error and you are positive that mysqli is installed, the issue is probably because you need mysqlnd. Checkout the following code snippet:

    $conn = new mysqli($servername, $username, $password, $database, $port);
    $r = $conn->query("SELECT * FROM `dummy`", MYSQLI_STORE_RESULT);
    $arr = FALSE;
    if($r !== FALSE)
        echo "<br />Vardump:<br/>";
        echo "<br /><br />Checking if methods exist:<br/>";     
        echo "<br />fetch_assoc() method exists? ";
        var_dump(method_exists($r, 'fetch_assoc'));
        echo "<br />fetch_all() method exists? ";
        var_dump(method_exists($r, 'fetch_all'));       
        echo "<br />";
        $arr = $r->fetch_all(MYSQLI_ASSOC);

When running this, you may encounter the following error:

fetch_assoc() method exists? bool(true)
fetch_all() method exists? bool(false)

The fetch_all() method within mysqli actually relies on mysqlnd being installed at compile time. If you are using CentOS, atomicorp has rpm’s within their repo that should install this:

Debian can be found here:

If you are running cPanel, add this:


To this:


And then run easyapache:

/scripts/easyapache --build

Now everytime you need to recompile, that flag will always be tacked on. Enjoy!