Enable mysqli using Easyapache 4 on cPanel/WHM

Enable mysqli using Easyapache 4

Default PHP MSQL extension is deprecated and it will be removed in the future PHP version. Instead of PHP mysql extension, mysqli should be used in the code to avoid PHP compatibility issue.

In EasyApache 3, we can select mysqli extension separately during Apache and PHP compilation using EasyApache 3. But in the latest cPanel version, we have to use EasyApache 4 to enable any PHP extension as EasyApache 3 is no longer available in new cPanel installation.

Enable mysqli using EasyApache 4

EasyApache 4 is now rpm based system and it is easy to use comparing to EasyApache 3.

If mysqli extension is not enabled on your cPanel and if you go to EasyApahce 4, you will notice that there is no separate selection to enable PHP mysqli extension. The reason is, mysqli extension is now provided by the mysqlnd package. That means if you enable mysqlnd package, it should include mysqli extension as well.

Steps to enable mysqli using EasyApache 4

You can enable mysqli directly from WHM. To enable it, you require WHM root login. Following are the steps to enable mysqli from WHM:

1. Login to WHM using root user.

2. Go to Home » Software » EasyApache 4 or you can directly search for Easyapache 4 from top-left search box.

3. Click on “Customize” button as shown in the following image:

EasyApache 4

4. Go to “PHP Extensions” and select all PHP versions for which you would like to enable mysqli.

PHP Extensions

5. In search box, type mysqlnd and enable php-mysqlnd extension.

mysqlnd

6. Click “Next” couple of times until you reach to the final step.

Once the process is complete, mysqli extension should be available for all selected PHP versions.

Also, you can check using command line:

[root@ ~]# rpm -ql ea-php83-php-mysqlnd
/opt/cpanel/ea-php83/root/etc/php.d/20-mysqlnd.ini
/opt/cpanel/ea-php83/root/etc/php.d/30-mysqli.ini
/opt/cpanel/ea-php83/root/etc/php.d/30-pdo_mysql.ini
/opt/cpanel/ea-php83/root/usr/lib64/php/modules/mysqli.so
/opt/cpanel/ea-php83/root/usr/lib64/php/modules/mysqlnd.so
/opt/cpanel/ea-php83/root/usr/lib64/php/modules/pdo_mysql.so

As you can see above, if you enable mysqlnd for PHP 8.3, it will also enable mysqli extension for PHP 8.3. If you still receive any error, you will have to make sure that there is no custom php.ini or .htaccess code which is changing your default PHP settings.

Leave a Reply