l0ve2hat3 Posted December 14, 2009 Share Posted December 14, 2009 $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 More sharing options...
killerb Posted December 14, 2009 Share Posted December 14, 2009 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 More sharing options...
l0ve2hat3 Posted December 15, 2009 Author Share Posted December 15, 2009 @billerb thanks for the help but that didnt work either... Does anyone have experience with gpg? is it that maybe the pub keys are only for the user that i am logged in as? Link to comment https://forums.phpfreaks.com/topic/185148-gpg-help/#findComment-977435 Share on other sites More sharing options...
l0ve2hat3 Posted December 15, 2009 Author Share Posted December 15, 2009 /usr/bin/gpg --help works... Link to comment https://forums.phpfreaks.com/topic/185148-gpg-help/#findComment-977446 Share on other sites More sharing options...
l0ve2hat3 Posted December 15, 2009 Author Share Posted December 15, 2009 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 More sharing options...
l0ve2hat3 Posted December 15, 2009 Author Share Posted December 15, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.