Below is a script you can run to install the GPG extension for the PHP 7.0 CLI on Ubuntu 16.04. It may work on other distributions and versions of PHP, but I have not tested that.
#!/bin/bash sudo apt install libgpgme11-dev php-pear php7.0-dev -y sudo pecl install gnupg # Update the php.ini files for Apache and the CLI SEARCH="; extension=msql.so" REPLACE="; extension=msql.so\nextension=gnupg.so" FILEPATH="/etc/php/7.0/cli/php.ini" sudo sed -i "s?$SEARCH?$REPLACE?" $FILEPATH
If you need to add it for php in Apache, then also run:
FILEPATH="/etc/php/7.0/apache2/php.ini" sudo sed -i "s?$SEARCH?$REPLACE?" $FILEPATH