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

Mary-Kate Olsen
Release: 2024-11-16 00:00:03
Original
890 people have browsed it

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-*
Copy after login

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
Copy after login

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
Copy after login

Verifying MySQLi Extension

Once Apache has restarted, use phpinfo() to verify that the MySQLi extension is now enabled:

<?php
phpinfo();
?>
Copy after login

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.

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template