If you are unable to install the mysqli extension for PHP 7.2, it's possible that the extension is not enabled or not available on your server. Here are some steps you can take to troubleshoot and resolve the issue:

  1. Check if mysqli extension is installed: First, verify if the mysqli extension is installed on your server. Create a PHP file (e.g., phpinfo.php) with the following content:
php
<?php phpinfo();

Upload this file to your server and access it through your browser (e.g., http://yourdomain.com/phpinfo.php). This will display a page with detailed information about your PHP configuration. Search for "mysqli" on that page to see if the extension is listed. If you can't find it, it means the mysqli extension is not installed.

  1. Install mysqli extension: If the mysqli extension is not installed, you'll need to install it. The process depends on your server's operating system and package manager.

For example, on Debian/Ubuntu-based systems, you can install the mysqli extension with the following command:

bash
sudo apt-get update sudo apt-get install php7.2-mysqli

For Red Hat/CentOS-based systems, you can use yum:

bash
sudo yum install php72w-mysqli

After installing the extension, don't forget to restart your web server (Apache or Nginx) to apply the changes.

  1. Enable mysqli extension: If the mysqli extension is installed but not enabled, you'll need to enable it in your PHP configuration.

Find the PHP configuration file (php.ini) used by PHP 7.2. You can find the path to the php.ini file by checking the Loaded Configuration File section in the phpinfo() output.

Open the php.ini file with a text editor and look for the following line:

ini
;extension=mysqli

Uncomment this line by removing the semicolon at the beginning:

ini
extension=mysqli

Save the changes and restart your web server again.

  1. Verify the installation: After enabling the mysqli extension and restarting the web server, create a simple PHP file to check if mysqli is now available:
php
<?php if (function_exists('mysqli_connect')) { echo "Mysqli extension is installed and enabled."; } else { echo "Mysqli extension is not available."; }

Upload this file to your server and access it through your browser. If you see the message "Mysqli extension is installed and enabled," then the installation was successful.

If you encounter any errors or issues during the installation process, check your server logs for more details. Additionally, make sure you have the appropriate permissions to install and enable extensions on your server. If you are using a shared hosting environment, you might need to contact your hosting provider for assistance.

Have questions or queries?
Get in Touch