Confirming MySQLnd as the Active Driver
While the presence of MySQLnd in phpinfo() indicates its installation, it does not guarantee that it is the active driver. To definitively determine whether MySQLnd is operational, additional measures are necessary.
Checking for MySQLnd in mysqli
To ascertain MySQLnd's status in mysqli, you can utilize the mysqli_fetch_all function. The presence of this function signifies that MySQLnd is enabled:
<code class="php">$mysqlnd = function_exists('mysqli_fetch_all'); if ($mysqlnd) { echo 'mysqlnd enabled!'; }</code>
Verifying MySQLnd for PDO
To confirm MySQLnd's active status in PDO, follow these steps:
<code class="php">if (strpos($pdo->getAttribute(PDO::ATTR_CLIENT_VERSION), 'mysqlnd') !== false) { echo 'PDO MySQLnd enabled!'; }</code>
The above is the detailed content of How Can I Verify That MySQLnd is the Active Driver in PHP?. For more information, please follow other related articles on the PHP Chinese website!