Using GnuPG with PHP

GnuPG is a great tool to encrypt texts and files and you can use it with PHP, only if you install it succesfully.

First, you will get this error : Fatal error: Class ‘gnupg’ not found in ….

OK the lib is not installed, do it with pecl

pecl install gnupg

But you will also have this error :

configure: error: Please reinstall the gpgme distribution
ERROR: `/tmp/pear/temp/gnupg/configure' failed

You need to install the libgpgme too !!!

apt-get install libgpgme11-dev

Now retry to install gnupg

pecl install gnupg

It should be OK.

Don’t forget to modify your php.ini file to load the extension

And of course, restart your apache web server

/etc/init.d/apache2 restart