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 http://www.gnupg.org/download/ and GNUPG PHP Extension from http://pecl.php.net/get/

wget ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.9.tar.gz
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 -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
./configure
make ; make install

Step 5: Installation of LibGPG-Error

cd /usr/local/src/libgpg-error-1.7
./configure
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 ‘extension=gnupg.so’ >> /usr/local/lib/php.ini
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

[root@support007 ~]# ldd /usr/local/lib/php/extensions/no-debug-non-zts-20060613/gnupg.so libgpgme.so.11 => not found libc.so.6 => /lib/libc.so.6 (0x002be000) /lib/ld-linux.so.2 (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/ld.so.conf and run ldconfig.

 

 Installation of GNUPG and GNUPG PHP extension

About 

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.