MySQL or MySQLi are used to connect to the database of a site. The mysqli_connect() function in PHP is used to connect a site to the database. In previous versions of PHP, mysql_connect() was used for connection. As mysql_connect() is now deprecated and mysqli_connect() was previously unavailable, errors on the site in regards to either function are typically related to a mismatched PHP version. This guide will cover some common error messages and how to correct the error.
Common Error Messages
Error: Failed to start application: The MySQLi extension for PHP is not installed or enabled.
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
SQL ERROR [ mysql4 ]
mysql_connect function does not exist, is mysql extension installed?
An sql error occurred while fetching this page. Please contact an administrator if this problem persists.
Checking the PHP Version
- Log into cPanel
- Navigate to MultiPHP Manager, located in the Software section
- If the error references mysql or mysql_connect, change the current PHP version to version 5.6 or lower
TIP: If updates are available for the website, such as with WordPress, updating the site can both clear this error as well as make the site more secure. - If the error references mysqli or mysqli_connect, change the current PHP version to version 7.0 or higher
- If the error references mysql or mysql_connect, change the current PHP version to version 5.6 or lower