In cPanel servers, the safest way to install PHP modules is to use the cPanel script for Apache-PHP compilation. You can do this as follows.
WHM login >> Main >> Software >> Apache Update
Or from the console execute /scripts/easyapache
Go through each step as follows.
1. Click “start customizing based on profile”
2. Select Apache Version – Click Next to proceed with the current version.
3. Select PHP Major Version – Click Next to proceed with the current version.
4. Select PHP Minor version – Click Next to proceed with the current version.
5. Short option list – Click Exhaustive Options List to view full options.
6 Exhaustive Options List – From here you can select the PHP modules you needed
In this case you need to select ‘GD’ and/or ‘CURL’
7. Click Save & Build to start apache-php compilation.
Once the compilation over you can verify the installed modules using the following command.
[root@servername ~]# php -m