← ServerPilot Docs

How to Install the PHP GnuPG Extension

In the examples shown, replace "X.Y" with your app's PHP version (for example, "7.1"). To install a PECL extension for multiple PHP versions, repeat the PECL extension installation for each PHP version.

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 GnuPG on PHP

As a PECL extension, GnuPG 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 GnuPG extension on PHP 5.4 through PHP 7.4, 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 GnuPG 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:

gnupg support => enabled

Uninstalling the GnuPG Extension

To uninstall this extension, as root run the commands:

sudo rm /etc/phpX.Y-sp/conf.d/gnupg.ini
sudo peclX.Y-sp uninstall gnupg

Next, restart PHP-FPM with the command:

sudo service phpX.Y-fpm-sp restart
Last updated: October 8, 2018

Launch your first site in 5 minutes