How can I enable the MySQLi extension in PHP 7?
To enable the MySQLi extension in PHP 7, you need to follow these steps.
The MySQLi extension has been bundled and enabled by default since PHP 5.3.0, so it is already active in PHP 7 and PHP 8. If you encounter a "Call to undefined function mysqli_connect()" error, it usually means the extension is disabled in your php.ini file or missing from your installation.
To enable it manually, follow these steps:
- Open your PHP configuration file (
php.ini). - Find the line that reads:
;extension=mysqli - Remove the semicolon (
;) from the beginning of the line to uncomment it. It should now look like this:extension=mysqli - Save the changes to your
php.inifile. - Restart your web server for the changes to take effect.
<div class="alert alert-info flex not-prose">![]()
<span class="hidden md:block">Watch a video course</span>Learn object oriented PHP</div>
We hope this helps! Let us know if you have any other questions.