Home > Database > Mysql Tutorial > How to Enable the MySQLi Extension in PHP 7?

How to Enable the MySQLi Extension in PHP 7?

Patricia Arquette
Release: 2024-12-30 08:16:10
Original
717 people have browsed it

How to Enable the MySQLi Extension in PHP 7?

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

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

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

Verification

To verify the successful enablement of the MySQLi extension, run the following command:

php -m | grep mysqli
Copy after login
Copy after login

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!

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