Home > Article > Backend Development > How to Enable the MySQLi Extension in PHP 7 on Ubuntu 14.04?
Enabling the MySQLi Extension in PHP 7
In PHP 7, the MySQLi extension provides improved MySQL database connectivity functionality. However, users may encounter issues with enabling this extension on Ubuntu 14.04. This article provides a step-by-step solution to successfully enable MySQLi in PHP 7.
Verifying Installed Extensions
To check if the MySQLi extension is installed, run the following command:
sudo apt-cache search php7-*
If MySQLi is not listed among the output, proceed with the following steps:
Updating Apache and PHP 7
The default PHP package for MySQL connectivity (php5-mysql) is deprecated. To resolve this, install the newer package:
sudo apt-get install php-mysql
This command will automatically update Apache and PHP 7.
Restarting Apache
After installing the new package, restart Apache to apply the changes:
sudo service apache2 restart
Verifying MySQLi Extension
Once Apache has restarted, use phpinfo() to verify that the MySQLi extension is now enabled:
<?php phpinfo(); ?>
Troubleshooting
If the MySQLi extension is still not enabled, check the following:
The above is the detailed content of How to Enable the MySQLi Extension in PHP 7 on Ubuntu 14.04?. For more information, please follow other related articles on the PHP Chinese website!