How can phpinfo() be used to check if MySQL is properly loaded in a PHP setup?
To check if MySQL is properly loaded in a PHP setup, you can use the phpinfo() function to display detailed information about your PHP configuration. Look for the MySQL section in the phpinfo() output to see if the MySQL extension is loaded. If it is not loaded, you may need to enable the MySQL extension in your php.ini file or install the necessary MySQL libraries.
<?php
// Check if MySQL extension is loaded
if (extension_loaded('mysqli')) {
echo 'MySQL is properly loaded in this PHP setup.';
} else {
echo 'MySQL is not loaded in this PHP setup. Please enable the MySQL extension.';
}
?>