Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Ubuntu 16.04 - Install GPG Extension for PHP 7

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.

Related Posts


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
sudo sed -i "s?$SEARCH?$REPLACE?" $FILEPATH

If you need to add it for php in Apache, then also run:

sudo sed -i "s?$SEARCH?$REPLACE?" $FILEPATH
Last updated: 26th February 2021
First published: 16th August 2018