Installation of GNUPG and GNUPG-PHP extension
GNU Privacy Guard (GnuPG or GPG) is a GPL Licensed alternative to the PGP suite of cryptographic software and in this post I am going to explain how you can install GNUPG and GNUPG PHP extensions on your Server.
Step 1: Go to download Directory
cd /usr/local/src/
Step 2: Download Required Modules
Download GNUPG, libgpg-error and GNUPGME (Made Easy) from http://www.gnupg.org/download/ and GNUPG PHP Extension from http://pecl.php.net/get/
wget ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.7.tar.bz2
wget ftp://ftp.gnupg.org/gcrypt/gpgme/gpgme-1.1.8.tar.bz2
wget http://pecl.php.net/get/gnupg-1.3.1.tgz
Step 3: Extract All the downloaded Modules
tar -jxvf libgpg-error-1.7.tar.bz2
tar -jxvf gpgme-1.1.8.tar.bz2
tar -zxvf gnupg-1.3.1.tgz
Step 4: Installation of GNUPG
./configure
make ; make install
Step 5: Installation of LibGPG-Error
./configure
make ; make install
Step 6: Installation of GPGME
./configure –with-gpgconf=/root/.gnupg/gpg.conf
make ; make install
Step 7: Installation GNUPG PHP Extension
phpize ./configure
make ; make install
Step 8: Enable PHP Extension
OR
echo ‘extension=gnupg.so’ >> /etc/php.ini
OR
Insert ‘extension=gnupg.so’ where php configuration file i.e. php.ini is located.
TROUBLESHOOTING
It happens sometime that after loading gnupg it doesn’t shows it in PHP info OR you get Message “error while loading shared libraries: libgpgme.so.11: cannot open shared object file: No such file or directory”. You can check the same using following command
The main reason for this problem is that the server doesn’t load libraries from /usr/local/lib folder. To fix this problem just add ‘/usr/local/lib‘ to /etc/ld.so.conf and run ldconfig.