I've asked this in SO but maybe here is more suitable to ask.
I'm installed GnuPG via Pecl. Generate pub/priv keys etc.. I have in php.ini
extension=gnupg.so
When I try to run simple code I've got undefined gnupg_init() error which by my understands is meaning that module isn't loaded.
Fatal error: Uncaught Error: Call to undefined function gnupg_init()
This is the code which I trying to run
putenv('GNUPGHOME=/home/stan/.gnupg');
$res = gnupg_init();
gnupg_seterrormode($res,GNUPG_ERROR_WARNING);
gnupg_addencryptkey($res,"myfingerprint");
$enc = gnupg_encrypt($res, "just a test");
echo $enc;
The system is ubuntu + apache.
Here are permissions of the .gnupg/
srwxrwxr-x 1 stan stan 0 Aug 16 08:12 S.gpg-agent
-rw------- 1 stan stan 32 Aug 16 10:02 pubring.kbx~
drwx------ 2 stan stan 4096 Aug 16 10:04 private-keys-v1.d
-rw-rw-r-- 1 stan stan 1361 Aug 16 10:04 pubring.kbx
drwx------ 2 stan stan 4096 Aug 16 10:04 openpgp-revocs.d
-rw------- 1 stan stan 2603 Aug 16 10:19 secring.gpg
-rw------- 1 stan stan 1209 Aug 16 10:19 pubring.gpg~
-rw------- 1 stan stan 1360 Aug 16 10:19 trustdb.gpg
-rw------- 1 stan stan 600 Aug 16 10:19 random_seed
-rw------- 1 stan stan 1209 Aug 16 10:19 pubring.gpg
Here is my /var/www/
drwxrwsr-x 3 stan www-data 4096 Jul 14 11:23 www
drwxr-sr-x 7 stan www-data 4096 Aug 16 09:59 html
I have also confirmation that is installed and loaded
$ php --info | grep gnupg
gnupg
gnupg support => enabled