|
Posted by shimmyshack on 03/09/07 00:50
On 8 Mar, 00:21, r_irwin_r...@yahoo.com wrote:
> Hi there,
>
> I'm very sorry to have to everyone but I've exhausted all options to
> get this to work. The gpg command is working fine on an apache server
> through the command prompt - I've added a key and successfully
> encrypted. However, I cannot get it working in PHP. The strange thing
> is it did previously work but now I just get "gpg: command not found"
> - I've no idea why this has stopped working.
>
> My path is /usr/local/bin/gpg
> The .gnupg folder contains:
> 666 trustdb.gpg
> 604 secring.gpg
> 604 random_seed
> 644 pubring.gpg
> 644 options
>
> I'm using the following code (using same command as I would in SSH)
> where the test.txt file contains some example text and user@domain
> would be my email user in the key ring:
>
> $gpg = '/usr/local/bin/gpg';
> $oldhome = getEnv("HOME");
> putenv("HOME=$gpg");
> echo shell_exec("gpg -a --always-trust --batch --no-secmem-warning -e -
> r u...@domain.com test.txt");
> putenv("HOME=$oldhome");
>
> Has anybody got any suggestions?
>
> Robin.
Are you are changing a path ($HOME) that is probably needed for the
correct running of other programs when you don't have to?
"gpg command cannot be found"
instead of changing the HOME env var, why not change working
directory, using
chdir()
example:
// current directory
echo getcwd() . "\n";
chdir('public_html');
// current directory
echo getcwd() . "\n";
output:
/home/vincent
/home/vincent/public_html
failing that - use absolute paths.
and issue exec( 'ls ); if you don't know where you are, just to check.
Navigation:
[Reply to this message]
|