Exit code 2 from PHP script

Brent Hagany bhagany at gofox.com
Fri Jan 18 21:39:39 CET 2008


This issue has been addressed several times on this list, but after
several hours of searching, I cannot find a solution that works for me.
Here's a simple test case that I cannot get to work:

$out = exec("/usr/bin/gpg --list-keys",$output,$return);

This, and everything like it, except "gpg --help" returns an exit code
of 2, with nothing in the output.

Ultimately, I want to encrypt a message and then email it, but I reduced
it to this simple case in an attempt to get it to work.  Now, some other
things: I can successfully do pretty much anything with gpg by running a
PHP script from the command line, as the same user that Apache runs
under (daemon, on my machine).  I have changed the permissions on
everything in daemon's .gnupg folder to 777.  I have confirmed that the
path to gpg is correct.  I've also tried every flag that looks like it
might remotely be of use.  Does anybody have any ideas about something
else I could try?  I feel like I've pretty much ruled out user-related
and permission-related problems - what are the other candidates for the
source of this kind of thing?

Thanks for taking the time, I appreciate it.


More information about the Gnupg-users mailing list