How to Install the PHP GnuPG Extension
The GnuPG extension allows you to encrypt and sign your data and communication while featuring a versatile key management system. GnuPG also allows you access to modules for many public key directories.
Installing GnuGP on PHP
As a PECL extension, GnuGP is installed using the peclX.Y-sp command, replacing "X.Y" the version of PHP running your app. If you have multiple apps using multiple versions of PHP, you will need to follow these instructions for each version of PHP.
To install the GnuGP extension on PHP 7.X or 5.X, run the following commands as your server's root user:
sudo apt-get -y install gcc make autoconf libc-dev pkg-config sudo apt-get -y install libgpgme11-dev
sudo peclX.Y-sp install gnupg sudo bash -c "echo extension=gnupg.so > /etc/phpX.Y-sp/conf.d/gnupg.ini" sudo service phpX.Y-fpm-sp restart
Verifying GnuGP Is Installed
Confirm the installation worked by running this command:
phpX.Y-sp -i | grep -i gnupg
If the installation was successful, you will see output like the following:
/etc/php7.0-sp/conf.d/gnupg.ini, gnupg gnupg support => enabled
Last updated: April 12, 2017