Reputation: 140205
I have to import a GPG key in a PHP script, it works using the command line
gpg --import "/home/me/pubkey.txt"
but does not work using the PHP gpg
class with the import
method even with the gnupg_import
function.
My configuration is:
I also tried using the exec
or system
functions of PHP, but with no success, with the same command line (exec('cat "/home/me/pubkey.txt"')
works so the file is readable).
Edit: It works on Ubuntu 9.10 Server with GnuPG 1.4.9, PHP 5.2.6.
Upvotes: 0
Views: 2806
Reputation: 26
Got it ! I am the one who had the problem, Fabien posted this question on SO.
It's a file permission issue : it tried to write in the .gnupg file on /root (the HOME env var) but PHP can't write in it.
We have to change the rights on this file so that PHP can write in it, or move this to a directory writeable by PHP.
What is the best solution ?
Upvotes: 1