Php gnupg = unable to load warning

gpginstallationlampPHP

End goal: use PHP GnuPG library in my Mediawiki extension

I have installed

  • gpgme with dependencies
  • run pecl install gnupg = no errors
  • added extension=gnupg.so to my php.ini

:

[root@dev-lamp01]# locate gnupg.so
/usr/lib64/php/modules/gnupg.so

[root@dev-lamp01]# file /usr/lib64/php/modules/gnupg.so
/usr/lib64/php/modules/gnupg.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped

[root@dev-lamp01]# locate  libgpgme.so.11
/usr/local/lib/libgpgme.so.11
/usr/local/lib/libgpgme.so.11.8.1

[root@dev-lamp01]# file /usr/local/lib/libgpgme.so.11
/usr/local/lib/libgpgme.so.11: symbolic link to `libgpgme.so.11.8.1'

[root@dev-lamp01]# file /usr/local/lib/libgpgme.so.11.8.1
/usr/local/lib/libgpgme.so.11.8.1: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped

yet:

PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib64/php/modules/gnupg.so' – libgpgme.so.11: cannot open shared
object file: No such file or directory in Unknown on line 0

what am i missing? thanks

Best Answer

Solution that fixed the problem in my case:

$ php -r 'var_dump(function_exists("gnupg_decrypt"));';

PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/gnupg.so' - **libgpgme.so.11: cannot open shared object file**: No such file or directory in Unknown on line 0
bool(false)

$ ldd /usr/lib/php5/20100525/gnupg.so
    linux-vdso.so.1 =>  (0x00007fff715ff000)
    **libgpgme.so.11 => not found**
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f087c815000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f087cdea000)

It seems that the server doesn’t load libraries from the /usr/local/lib folder. To fix this problem just add /usr/local/lib to /etc/ld.so.conf or/and run ldconfig.

Related Topic