Activate PHP extensions

I struggled with this a bit at the beginning coming from cPanel/WHM and being a noob with yum. Now, I prefer using the command line and yum.

In case it helps someone else, here are a few things I found very helpful.

Check Installed PHP Modules

yum list installed *php*

Or, if you want to see the modules installed for a particular version, use:

yum list installed *php73*

Install Multiple Packages at Once

yum install package-one package-two package-three

Installing for the System

I had an issue installing SOAP so it would be available for a WHMCS cron job. I could see SOAP was installed for the default version of PHP (7.4):

# yum list installed *php-soap*
...
php74-php-soap.x86_64
...

which happened to be the same version of PHP the system was using, but when I checked the system php.ini (the one you see when you click the PHP Info link in Nodeworx -> Web Server), SOAP wasn’t there. What worked was to install php-soap.x86-64, rather than the version specific to PHP 7.4 using the following command:

yum install php-soap

After that, SOAP showed up in the system php.ini, and was available for cron.

Removing PHP Modules

To remove a PHP module, run the following command:

yum remove php <php-module-name-here>

or to remove multiple PHP modules:

yum remove php <php-module-name-here> <php-other-module-name-here> <php-another-module-name-here>

Restart to Make Changes Available

Finally, it’s been a while since I’ve done it, but I think if you’re running PHP-FPM, once you add a module, all you need to do is restart PHP-FPM from the Nodeworx -> Web Server UI to make them available.

Confirming a Module is Available

As noted in previous posts, you need to install required modules for each version of PHP you want them to be available for. The easiest way to do that for me is to create a PHP file with the phpinfo command in it:

phpinfo();

and upload it to a site that’s using the version of PHP you’re working with, then browse to it in order to search it for the module in question.

Version-Specific Ini Files

In case you need it, the location of the version-specific php.inis is:

/etc/opt/remi/php<version number; e.g., "74">
2 Likes