1 (edited by Adrien_D 2023-02-15 16:24:17)

Topic: SOLVED PHP81+EL7 : PHP Startup: Unable to load dynamic library 'sodium

Hi Remi,

I upgraded a PHP 7.4 install on CentOS7 to PHP 8.1.

After installing same modules with :

yum install php-{common,intl,json,ldap} php81-php php81-php-{bcmath,cli,common,gd,intl,json,ldap,mbstring,mysqlnd,opcache,pdo,pecl-mysql,pecl-ssh2,pecl-zip,soap,xml} php81-runtime

Checking all is okay with

php -v

I have this warning :

PHP Warning:  PHP Startup: Unable to load dynamic library 'sodium' (tried: /opt/remi/php81/root/usr/lib64/php/modules/sodium (/opt/remi/php81/root/usr/lib64/php/modules/sodium: cannot open shared object file: No such file or directory), /opt/remi/php81/root/usr/lib64/php/modules/sodium.so (/opt/remi/php81/root/usr/lib64/php/modules/sodium.so: undefined symbol: crypto_core_ristretto255_sub)) in Unknown on line 0
PHP 8.1.16 (cli) (built: Feb 14 2023 18:59:41) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.1.16, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.16, Copyright (c), by Zend Technologies


Packages installed related to sodium :

libsodium-last-1.0.14-1.el7.remi.x86_64
php81-php-sodium-8.1.16-1.el7.remi.x86_64
libsodium23-1.0.16-1.el7.remi.x86_64

What is wrong ?

Thanks

Re: SOLVED PHP81+EL7 : PHP Startup: Unable to load dynamic library 'sodium

> ... on CentOS7 ...

CentOS 7 is terribly old (>8 years), close to its end of live
I recommends you use a modern distro (EL-8 or EL-9), especially for modern features (e.g. PHP 8.x)

> yum install php-{common,intl,json,ldap} php81-php php81-php-{bcmath,cli,common,gd,intl,json,ldap,mbstring,mysqlnd,opcache,pdo,pecl-mysql,pecl-ssh2,pecl-zip,soap,xml} php81-runtime

You are mixing php-* and php81-php-* packages, which will result in a messy installation

See https://blog.remirepo.net/pages/English-FAQ#scl

For a proper installation, follow the wizard instructions:

https://rpms.remirepo.net/wizard/

> libsodium-last-1.0.14-1.el7.remi.x86_64
> libsodium23-1.0.16-1.el7.remi.x86_64

remove above, you need libsodium-1.0.18 from "EPEL" (which is probably missing, if it was not pulled from there)

Laptop:  Fedora 40 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: AlmaLinux 8 with EPEL, rpmfusion, remi

Re: SOLVED PHP81+EL7 : PHP Startup: Unable to load dynamic library 'sodium

I don't have choice for the CentOS 7 for now, application will be migrated at end of 2023 on Red Hat EL9.

php-intl, json and ldap not installed with the command (wrong copy paste :S ) :

[root@WWW ~]# rpm -qa | grep php
php81-php-common-8.1.16-1.el7.remi.x86_64
php81-php-mysqlnd-8.1.16-1.el7.remi.x86_64
php-intl-8.1.16-1.el7.remi.x86_64
php81-php-gd-8.1.16-1.el7.remi.x86_64
php81-php-opcache-8.1.16-1.el7.remi.x86_64
gd3php-2.3.3-7.el7.remi.x86_64
php-common-8.1.16-1.el7.remi.x86_64
php-ldap-8.1.16-1.el7.remi.x86_64
php81-php-mbstring-8.1.16-1.el7.remi.x86_64
php81-php-soap-8.1.16-1.el7.remi.x86_64
oniguruma5php-6.9.8-1.el7.remi.x86_64
php81-php-cli-8.1.16-1.el7.remi.x86_64
php81-php-pecl-ssh2-1.3.1-3.el7.remi.x86_64
php81-php-ldap-8.1.16-1.el7.remi.x86_64
php81-php-bcmath-8.1.16-1.el7.remi.x86_64
php81-php-sodium-8.1.16-1.el7.remi.x86_64
php81-runtime-8.1-1.el7.remi.x86_64
php81-php-pdo-8.1.16-1.el7.remi.x86_64
php81-php-pecl-mysql-1.0.0-0.25.20210423.ca514c4.el7.remi.x86_64
php81-php-xml-8.1.16-1.el7.remi.x86_64
php81-php-intl-8.1.16-1.el7.remi.x86_64
php81-php-pecl-zip-1.21.1-1.el7.remi.x86_64
php81-php-8.1.16-1.el7.remi.x86_64


Installing php81-php install by dep "libsodium23" :

========================================================================================================================
Package                         Arch                  Version                           Repository                Size
========================================================================================================================
Installing:
php81-php                       x86_64                8.1.16-1.el7.remi                 remi-safe                2.0 M
Installing for dependencies:
libsodium23                     x86_64                1.0.16-1.el7.remi                 remi-safe                141 k
php81-php-sodium                x86_64                8.1.16-1.el7.remi                 remi-safe                 91 k

Transaction Summary
========================================================================================================================
Install  1 Package (+2 Dependent packages)


I removed all libsodium
I installed libsodium from EPEL
And reinstalled php81-php + php81-php-sodium

It's OK

Thanks

Re: SOLVED PHP81+EL7 : PHP Startup: Unable to load dynamic library 'sodium

> It's OK

smile

BTW, your installation is still a mess,
with PHP 8.1 installed twice
so read again the FAQ and Wizard from my previous answer.

Laptop:  Fedora 40 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: AlmaLinux 8 with EPEL, rpmfusion, remi

Re: SOLVED PHP81+EL7 : PHP Startup: Unable to load dynamic library 'sodium

Yes, i will fix the strange installation.