Use extension_loaded() to verify that the MySQLi extension is available in the current PHP runtime.
<?php
if (extension_loaded('mysqli')) {
echo 'MySQLi is available';
echo '<br>Client: ' . mysqli_get_client_info();
} else {
echo 'MySQLi is not enabled';
}
?>
if (function_exists('mysqli_connect')) {
echo "mysqli is installed";
}else{
echo " Enable Mysqli support in your PHP installation ";
}
Download files to test your MySQLI support

You can verify MySQLi installation by running a simple PHP script. This script will confirm if the MySQLi extension is enabled:
<?php
if (function_exists('mysqli_connect')) {
echo "MySQLi is installed and working.";
} else {
echo "MySQLi is not installed.";
}
?>
Once installed, you can create a basic connection to the MySQL database using MySQLi:
<?php
$host = "localhost";
$user = "root";
$pass = "password";
$db = "test_db";
$connection = mysqli_connect($host, $user, $pass, $db);
if (!$connection) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully!";
?>
MySQLi must be installed and enabled by the PHP runtime or hosting environment. It cannot be enabled for the first time with ini_set() inside a script. On managed hosting, use the provider's PHP extension selector or contact the host; on your own server, install the matching PHP MySQL package and restart the relevant PHP/web service if required.
On systems you administer, install the MySQL extension package that matches your PHP version. Package names vary by operating system and repository; verify the package for your installed PHP version.
// For Ubuntu/Debian
sudo apt-get install php-mysqli
Ensure that the MySQLi extension is enabled in your *php.ini* configuration file:
extension=mysqli
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.