Welcome to yet another howto. Those instructions should probably solve stuff that is impossible to find "bundled" at any search engine. There's only questions, questions and questions, but never answers. So here we go!


Bundled installation of gnupg into PHP, step by step. You can probably also build gnupg as an extension, but I chose to bundle the package. You should also be aware of the path to your keys if you start your server with a root account, or if you run apache with suid-users. You may have to give gnupg some information about where it can find the keys, especially if root is involved.

[php]
$gnupghome="/home/users/gnupg/.gnupg";
putenv("GNUPGHOME=$gnupghome");
[/php][B]Requirements and useful links[/B][INDENT][I]Physical access to a webserver or a webhotel that support gnupg.[/I]

gnupg ([URL]http://www.gnupg.org/[/URL])
gpgme ([URL]http://www.gnupg.org/gpgme.html[/URL])
php gnupg ([URL]http://pecl.php.net/package/gnupg[/URL])

[I]libs and addons that might be needed[/I]
libgpg-error ([URL]http://www.gnupg.org/related_software/libgpg-error/[/URL])
re2c ([URL]http://sourceforge.net/projects/re2c[/URL])
[/INDENT][B]PHP Bundling

[/B][INDENT] [FONT=Courier New]cd php-source/ext
pecl download gnupg
tar zxvf gnupg-1.3.1.tgz
mv gnupg-1.3.1 gnupg
cd ..
mv configure configure_the_backup_plan
./buildconf --force
[/FONT][INDENT]A lot of work here[/INDENT]Now let's check if we have the gnupg-switches
[FONT=Courier New]./configure --help[/FONT][INDENT]At least I have:

--with-gnupg=dir Include gnupg support
[/INDENT][FONT=Comic Sans MS]configure --with-switches[/FONT]

Now, this shows up[INDENT]configure:56876: checking for gnupg support
configure:56915: result: yes
configure:56927: checking for gnupg files in default path
configure:56932: result: found in /usr/local/include[/INDENT][FONT=Courier New]make
make install
[/FONT]
And phpinfo() says:

[IMG]http://www.tornevall.net/storage/files/1199660400/1199742678_gnupg_static.jpg[/IMG]


[B][COLOR=DarkRed]Probably, if everything works properly, you could also use this command to make it easier for yourself (if you have access to pear and pecl):

[/COLOR][/B] [FONT=Courier New][COLOR=DarkRed][B]pecl install gnupg[/B]
[/COLOR][/FONT][/INDENT]