Enabling MySQLi Extension in PHP 7
When encountering difficulties in using phpMyAdmin due to a missing MySQLi extension, it's essential to resolve the issue. Before searching for solutions, verify that the extension is indeed not enabled in PHP 7.
To confirm the absence of the MySQLi extension, run the following command:
php -m | grep mysqli
If no output is returned, the MySQLi extension is not enabled.
Installation and Enablement
To enable the MySQLi extension in PHP 7, install the php-mysql package:
sudo apt-get install php-mysql
This package serves as a replacement for the deprecated php5-mysql package, which was used for connecting PHP to MySQL.
Automatic Apache and PHP 7 Update
Installing the php-mysql package automatically updates Apache and PHP 7. This process ensures that the necessary configurations are implemented and the MySQLi extension is activated.
Restart Services
Once the installation is complete, restart the Apache and PHP 7 services to reflect the changes:
sudo service apache2 restart sudo service php7.0-fpm restart
Verification
To verify the successful enablement of the MySQLi extension, run the following command:
php -m | grep mysqli
The output should now include mysqli. Additionally, phpMyAdmin should now be functional without any missing extension errors.
The above is the detailed content of How to Enable the MySQLi Extension in PHP 7?. For more information, please follow other related articles on the PHP Chinese website!