[thelist] GPG not producing output in PHP script

Bob Meetin bobm at dottedi.biz
Thu Nov 29 16:34:08 CST 2007

I have a php script in which am trying to use GPG to encrypt a file 
(later to decrypt).  At the command line linux prompt it works 
marvelously.  Given a valid key the following works (substituting a live 
one for abc at xyz.com)

% gpg -e -r abc at xyz.com readme <cr>

I have been trying to use system, shell_exec, passthru, etc. but cannot 
get it to write an output file, which by default would be readme.gpg.

chdir (/home/whatever);
system ("/usr/bin/gpg -e -r abc at xyz.com readme");

system ("/usr/bin/gpg -o readme.encrypted -e -r abc at xyz.com readme"); // 
option to force output filename

If I use fwrite to write to a file in the folder it is fine.  Changing 
directory permissions has not helped.  Where has my thinking gone south?

Bob Meetin

More information about the thelist mailing list