Installation of GNUPG and GNUPG-PHP extension

By: Published: Dec 28th, 2012 Category: Linux Tips

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 and GNUPG PHP Extension from


Step 3: Extract All the downloaded Modules

tar -zvf gnupg-1.4.9.tar.gz
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

cd /usr/local/src/gnupg-1.4.9
make ; make install

Step 5: Installation of LibGPG-Error

cd /usr/local/src/libgpg-error-1.7
make ; make install

Step 6: Installation of GPGME

cd /usr/local/src/gpgme-1.1.8
./configure –with-gpgconf=/root/.gnupg/gpg.conf
make ; make install

Step 7: Installation GNUPG PHP Extension

cd /usr/local/src/gnupg-1.3.1
phpize ./configure
make ; make install

Step 8: Enable PHP Extension

echo ‘’ >> /usr/local/lib/php.ini
echo ‘’ >> /etc/php.ini
Insert ‘’ where php configuration file i.e. php.ini is located.


It happens sometime that after loading gnupg it doesn’t shows it in PHP info OR you get Message “error while loading shared libraries: cannot open shared object file: No such file or directory”. You can check the same using following command

[root@support007 ~]# ldd /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ => not found => /lib/ (0x002be000) /lib/ (0x00c94000

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/ and run ldconfig.



Milind Koyande is a Project Manager and his job is to work with new technologies, specially Cloud Computing / Virtualization Technology. His past projects include Government Sector initiatives, Backup and Disaster Recovery Solutions.

Tags: , , , , , ,

Leave a Reply

Subscribe to eITWebguru

© 2012 eITWebguru. All Rights Reserved.