This what worked for me while I was having issues installing Drupal on a VPS server. I needed to install PHP Extensions and I found the method that eventually worked for me.

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 using two ways, web browser or via console/ssh!

Web Browser => WHM login >> Main >> Software >> Apache Update
Console => 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