Jump to content

gpg help


l0ve2hat3

Recommended Posts

$file_out_fp="/home/bankcard/feeds/priority/out/PPS20091214.imp";
$command = "/usr/bin/gpg -e -u [email protected] -r [email protected] ".$file_out_fp;
shell_exec($command);

 

Works in command line, but not in php.  gpg has 777 permissions and so does the file path.

 

shell_exec() works with other commands

Link to comment
https://forums.phpfreaks.com/topic/185148-gpg-help/
Share on other sites

Reminds me of a problem I had with exec and mysqldump, the -p parameter was fine in shell as such:

 

mysqldump -u root -p mypass

 

but when running through PHP's exec() function it had to have no space after the -p argument:

 

mysqldump -u root -pmypass

 

Took a bit of stabbing in dark to discover this, hope the info might be of some help.

Link to comment
https://forums.phpfreaks.com/topic/185148-gpg-help/#findComment-977339
Share on other sites

ok well i figured it out...

 

i copied all the files from /root/.gpupg to /.gpupg and changed the owner to nobody(my apache runs as this user)

 

then added this option to the command --homedir=/.gnupg

 

$file_out_fp="/home/bankcard/feeds/priority/out/PPS20091214.imp";
$command = "/usr/bin/gpg --homedir=/.gnupg -e -u [email protected] -r [email protected] ".$file_out_fp;
shell_exec($command);

Link to comment
https://forums.phpfreaks.com/topic/185148-gpg-help/#findComment-977482
Share on other sites

one last comment to help anyone in the future.... be sure to add the --no-tty option if the command you are using is outputting something to the terminal. This is necessary when decrypting a file.

 

/usr/bin/gpg --homedir=/.gnupg --no-tty --passphrase="YOURPASSWORD" -u"[email protected]" -o"/home/decrypted.file" -d "/home/encrypted.file"

Link to comment
https://forums.phpfreaks.com/topic/185148-gpg-help/#findComment-978067
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.