"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How to Enable the MySQLi Extension in PHP 7 on Ubuntu 14.04?

How to Enable the MySQLi Extension in PHP 7 on Ubuntu 14.04?

Published on 2024-11-12
Browse:987

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:

Troubleshooting

If the MySQLi extension is still not enabled, check the following:

  • Ensure that the mysqli module is loaded in your PHP configuration file (php.ini).
  • Verify that your PHP version is up to date.
  • If using a non-default PHP installation, adjust the paths in your .bashrc file to point to the correct PHP and Apache directories.
Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3