Help! Gnupg can't run in php program

Haibo Liu lhb at array-it.com
Wed Aug 30 10:18:33 CEST 2006


Thanks for you help.

I now get a solution from www.zend.com.

Try echo system("gpg --help"), then echo 
system("gpg --list-keys"). If help works but list 
keys does not, then you might try the 
following:-

1. Set the following permissions
chmod 777 .gnupg 
chmod 666 trustdb.gpg 
chmod 604 secring.gpg 
chmod 604 random_seed 
chmod 644 pubring.gpg 

2. use the --homedir setting with gpg
i.e. gpg --list-keys --
homedir /usr/local/home/root/.gnupg
----- Original Message ----- 
From: "Cameron Metzke" <cmetzke at gmail.com>
To: "Haibo Liu" <lhb at array-it.com>
Sent: Monday, August 28, 2006 11:26 AM
Subject: Re: Help! Gnupg can't run in php program


> Make sure you have the right permissions on your ./gnupg folder and
> relivent files to allow the user www-data to access them, just an idea :)
> Haibo Liu wrote:
>> Hello,
>> 
>> Does anybody use GnuPG in PHP program?
>> The server is on Debian OP.
>> 
>> I create my key pair in the ./gnupg directory.
>> And the command "gpg --help" runs as normal.
>> But the command "gpg --list-keys" failed.
>> 
>> What's the problem?
>> 
>> My code is below:
>> 
>> <?php
>> 
>> $val_return = -1;
>> 
>> $cmd = "gpg --help";
>> system($cmd, $val_return);
>> 
>> echo "<br>";
>> echo "cmd: $cmd, return code: $val_return<br>";
>> 
>> $cmd = "gpg --homedir ./gnupg --list-keys";
>> system($cmd, $val_return);
>> 
>> echo "<br>";
>> echo "cmd: $cmd, return code: $val_return<br>";
>> 
>> ?>
>> 
>> lhb
>> 
>> _______________________________________________
>> Gnupg-users mailing list
>> Gnupg-users at gnupg.org
>> http://lists.gnupg.org/mailman/listinfo/gnupg-users
>> 
>



More information about the Gnupg-users mailing list