Trying to encrypt mails with gnupg, the method call gnupg::keyinfo()
throws the error could not init keylist
.
This is how I initialize the extension:
putenv('GPGME_DEBUG=9:./gnupg/debug.log');
putenv('GNUPGHOME=./gnupg/');
$this->gpg = new gnupg();
$this->gpg->seterrormode(gnupg::ERROR_EXCEPTION);
Where gnupg really does exist (calling is_dir('./gnupg')
returns true
- I've also tried the absolute path without success).
Some additional information:
PHP-CLI
. (However, I need it using HTTP)Linux name 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 GNU/Linux
gpg --version
-> gpg (GnuPG) 1.4.10
client
-> nginx
-> apache
-> php 5.3
drwxrwxrwx 4 www-data web1 4096 29. Nov 12:30 .
The debug.log shows the following error:
_gpgme_io_set_close_notify (fd=0x282): enter: close_handler=0x7f6d2a409780/0x7f6d38edb730
_gpgme_io_set_close_notify (fd=0x282): error: Invalid argument
The full debug log is uploded here: http://nopaste.penguinfriends.org/view/84317/
Thanks in advance!
When you run from the command line, the GNUPGHOME
path you specified is relative to your working directory where you are when you run the script. From a web environment you can't rely on a particular working directory so you may need to specify the full absolute path to your gnupg directory. You could, however, specify the path relative to the current script:
putenv('GNUPGHOME='.dirname(__FILE__).'/gnupg');
Also, you shouldn't ever use 777
permissions, especially with programs related to security like ssh
and gnupg
that may check and refuse, but 775
might have worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With