gpg and PHP (return value 2)

Samuel ]slund samuel at Update.UU.SE
Wed Nov 9 19:16:10 CET 2005

On Wed, Nov 09, 2005 at 03:29:38PM +0100, zvrba at wrote:
> On Wed, Nov 09, 2005 at 12:08:16PM -0000, Pete Croft wrote:
> > 
> > I suspect it's a permissions problem:  the source file for encryption
> > exists, the key is correct, and the exact same command issued via CLI
> > produces the output file as desired, so in the absence of other evidence
> > I'm guessing that the user PHP's running as can't get to gpg, or doesn't
> > have permission to execute it?
> > 
> Or doesn't have permissions to read/write the source/destination file. Does it
> have gpg in PATH? Do you specify a full path to the binary in your script?

A quick check gives me a 126 from my shell (zsh) if I do not have
permission to execute a file. 127 if it can not find the file.

I have frequently heard of file permissions on the key-ring as a source
of trouble in the setting you describe. PHP is probably running a nobody
or Apache or something equally restrictive, with good reason. For other
good reasons the key-rings usually have read and write permissions for
only the user.


More information about the Gnupg-users mailing list