Problem using gnupg from PHP

Patrick Hanna pchanna1 at insightbb.com
Thu Jun 24 16:46:22 CEST 2010


I am using exec() calls to run pgp from within a php script.  I can decrypt
a file without any problem but when I try to encrypt, I get a return code of
2 from pgp.  Here are the commands that I am using.

 

echo mypassphrase| gpg --passphrase-fd 0 --batch -o /home/pat/testfile.2 -d
/home/pat/testfile.1  (Works great)

 

gpg -e -r "myrecipient" -o /home/pat/testfiel.2 -e /home/pat/testfile.1
(Fails with return code = 2)

 

Both commands work great from a shell command line.

 

Inside my php script I use the following command structure:

 

$gpgcmd = "gpg -e -r "recipient" -o /home/pat/testfiel.2 -e
/home/pat/testfile.1";

exec($gpgcmd, $out_arr, $ret_code);

 

I am using gnupg version 1.2.3

 

Can anyone tell me what the return code = 2 implies?  Or any reason that the
encryption is failing?

 

Thank you,

Pat

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20100624/e840a0d5/attachment.htm>


More information about the Gnupg-devel mailing list