Ubuntu – Unable to install PHP 7: error undefined symbol: crypto_pwhash_scryptsalsa208sha256_memlimit_interactive

ovhPHPUbuntu

I can not install install php on my server.
I always have the same error :

May 10 12:26:13 vps819983 systemd[1]: Starting The PHP 7.3 FastCGI Process Manager...
May 10 12:26:13 vps819983 php-fpm7.3[30288]: /usr/sbin/php-fpm7.3: symbol lookup error: /usr/sbin/php-fpm7.3: undefined symbol: crypto_pwhash_scryptsalsa208sha256_memlimit_interactive
May 10 12:26:13 vps819983 systemd[1]: php7.3-fpm.service: Main process exited, code=exited, status=127/n/a
May 10 12:26:13 vps819983 systemd[1]: php7.3-fpm.service: Failed with result 'exit-code'.
May 10 12:26:13 vps819983 systemd[1]: Failed to start The PHP 7.3 FastCGI Process Manager.

Here is what I've tried :

root@vps:~# apt purge php*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'php-horde-timeobjects' for glob 'php*'
Note, selecting 'php7.3-pdo-dblib' for glob 'php*'
Note, selecting 'php-exif' for glob 'php*'
Note, selecting 'php-http-message-factory' for glob 'php*'
[...]
The following packages will be REMOVED:
  php-common* php-fpm* php7.2-cli* php7.2-common* php7.2-fpm* php7.2-json* php7.2-mysql* php7.2-opcache* php7.2-readline* php7.2-xml* php7.3-cli* php7.3-common* php7.3-fpm* php7.3-json* php7.3-opcache* php7.3-readline*
0 upgraded, 0 newly installed, 16 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 17.7 MB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 107367 files and directories currently installed.)
Removing php-fpm (2:7.3+69ubuntu2) ...
Removing php7.3-fpm (7.3.11-0ubuntu0.19.10.4) ...
apache2_invoke php7.3-fpm prerm: No action required
Removing php7.3-cli (7.3.11-0ubuntu0.19.10.4) ...
Removing php7.3-readline (7.3.11-0ubuntu0.19.10.4) ...
Removing php7.3-opcache (7.3.11-0ubuntu0.19.10.4) ...
Removing php7.3-json (7.3.11-0ubuntu0.19.10.4) ...
Removing php7.3-common (7.3.11-0ubuntu0.19.10.4) ...
Removing php-common (2:69ubuntu2) ...
Processing triggers for man-db (2.8.7-3) ...
(Reading database ... 107235 files and directories currently installed.)
Purging configuration files for php7.2-common (7.2.30-1+ubuntu19.10.1+deb.sury.org+1) ...
Purging configuration files for php-common (2:69ubuntu2) ...
Purging configuration files for php7.2-opcache (7.2.30-1+ubuntu19.10.1+deb.sury.org+1) ...
Purging configuration files for php7.2-cli (7.2.30-1+ubuntu19.10.1+deb.sury.org+1) ...
Purging configuration files for php7.3-fpm (7.3.11-0ubuntu0.19.10.4) ...
apache2_invoke php7.3-fpm postrm: No action required
Purging configuration files for php7.3-json (7.3.11-0ubuntu0.19.10.4) ...
Purging configuration files for php7.3-readline (7.3.11-0ubuntu0.19.10.4) ...
Purging configuration files for php7.2-fpm (7.2.30-1+ubuntu19.10.1+deb.sury.org+1) ...
apache2_invoke postrm: Purging state for php7.2-fpm
Purging configuration files for php7.3-common (7.3.11-0ubuntu0.19.10.4) ...
Purging configuration files for php7.2-json (7.2.30-1+ubuntu19.10.1+deb.sury.org+1) ...
Purging configuration files for php7.2-mysql (7.2.30-1+ubuntu19.10.1+deb.sury.org+1) ...
Purging configuration files for php7.3-cli (7.3.11-0ubuntu0.19.10.4) ...
Purging configuration files for php7.3-opcache (7.3.11-0ubuntu0.19.10.4) ...
find: ‘/etc/php/’: No such file or directory
Purging configuration files for php7.2-xml (7.2.30-1+ubuntu19.10.1+deb.sury.org+1) ...
find: ‘/etc/php/’: No such file or directory
find: ‘/etc/php/’: No such file or directory
find: ‘/etc/php/’: No such file or directory
find: ‘/etc/php/’: No such file or directory
find: ‘/etc/php/’: No such file or directory
find: ‘/etc/php/’: No such file or directory
find: ‘/etc/php/’: No such file or directory
Purging configuration files for php7.2-readline (7.2.30-1+ubuntu19.10.1+deb.sury.org+1) ...
find: ‘/etc/php/’: No such file or directory
Processing triggers for systemd (242-7ubuntu3.7) ...

Everythings seems to be removed.
Also removed /etc/php and /usr/lib/php directories and then reinstall php

root@vps:~# whereis php
php: /usr/lib/php /etc/php
root@vps:~# rm -rf /etc/php/
root@vps:~# rm -rf /usr/lib/php
root@vps:~# apt install php-fpm
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  php-common php7.3-cli php7.3-common php7.3-fpm php7.3-json php7.3-opcache php7.3-readline
Suggested packages:
  php-pear
The following NEW packages will be installed:
  php-common php-fpm php7.3-cli php7.3-common php7.3-fpm php7.3-json php7.3-opcache php7.3-readline
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/3,987 kB of archives.
After this operation, 17.7 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Selecting previously unselected package php-common.
(Reading database ... 107212 files and directories currently installed.)
Preparing to unpack .../0-php-common_2%3a69ubuntu2_all.deb ...
Unpacking php-common (2:69ubuntu2) ...
Selecting previously unselected package php7.3-common.
Preparing to unpack .../1-php7.3-common_7.3.11-0ubuntu0.19.10.4_amd64.deb ...
Unpacking php7.3-common (7.3.11-0ubuntu0.19.10.4) ...
Selecting previously unselected package php7.3-json.
Preparing to unpack .../2-php7.3-json_7.3.11-0ubuntu0.19.10.4_amd64.deb ...
Unpacking php7.3-json (7.3.11-0ubuntu0.19.10.4) ...
Selecting previously unselected package php7.3-opcache.
Preparing to unpack .../3-php7.3-opcache_7.3.11-0ubuntu0.19.10.4_amd64.deb ...
Unpacking php7.3-opcache (7.3.11-0ubuntu0.19.10.4) ...
Selecting previously unselected package php7.3-readline.
Preparing to unpack .../4-php7.3-readline_7.3.11-0ubuntu0.19.10.4_amd64.deb ...
Unpacking php7.3-readline (7.3.11-0ubuntu0.19.10.4) ...
Selecting previously unselected package php7.3-cli.
Preparing to unpack .../5-php7.3-cli_7.3.11-0ubuntu0.19.10.4_amd64.deb ...
Unpacking php7.3-cli (7.3.11-0ubuntu0.19.10.4) ...
Selecting previously unselected package php7.3-fpm.
Preparing to unpack .../6-php7.3-fpm_7.3.11-0ubuntu0.19.10.4_amd64.deb ...
Unpacking php7.3-fpm (7.3.11-0ubuntu0.19.10.4) ...
Selecting previously unselected package php-fpm.
Preparing to unpack .../7-php-fpm_2%3a7.3+69ubuntu2_all.deb ...
Unpacking php-fpm (2:7.3+69ubuntu2) ...
Setting up php-common (2:69ubuntu2) ...
Created symlink /etc/systemd/system/timers.target.wants/phpsessionclean.timer → /lib/systemd/system/phpsessionclean.timer.
Setting up php7.3-common (7.3.11-0ubuntu0.19.10.4) ...

Creating config file /etc/php/7.3/mods-available/calendar.ini with new version

Creating config file /etc/php/7.3/mods-available/ctype.ini with new version

Creating config file /etc/php/7.3/mods-available/exif.ini with new version

Creating config file /etc/php/7.3/mods-available/fileinfo.ini with new version

Creating config file /etc/php/7.3/mods-available/ftp.ini with new version

Creating config file /etc/php/7.3/mods-available/gettext.ini with new version

Creating config file /etc/php/7.3/mods-available/iconv.ini with new version

Creating config file /etc/php/7.3/mods-available/pdo.ini with new version

Creating config file /etc/php/7.3/mods-available/phar.ini with new version

Creating config file /etc/php/7.3/mods-available/posix.ini with new version

Creating config file /etc/php/7.3/mods-available/shmop.ini with new version

Creating config file /etc/php/7.3/mods-available/sockets.ini with new version

Creating config file /etc/php/7.3/mods-available/sysvmsg.ini with new version

Creating config file /etc/php/7.3/mods-available/sysvsem.ini with new version

Creating config file /etc/php/7.3/mods-available/sysvshm.ini with new version

Creating config file /etc/php/7.3/mods-available/tokenizer.ini with new version
Setting up php7.3-opcache (7.3.11-0ubuntu0.19.10.4) ...

Creating config file /etc/php/7.3/mods-available/opcache.ini with new version
Setting up php7.3-json (7.3.11-0ubuntu0.19.10.4) ...

Creating config file /etc/php/7.3/mods-available/json.ini with new version
Setting up php7.3-readline (7.3.11-0ubuntu0.19.10.4) ...

Creating config file /etc/php/7.3/mods-available/readline.ini with new version
Setting up php7.3-cli (7.3.11-0ubuntu0.19.10.4) ...
update-alternatives: using /usr/bin/php7.3 to provide /usr/bin/php (php) in auto mode
update-alternatives: using /usr/bin/phar7.3 to provide /usr/bin/phar (phar) in auto mode
update-alternatives: using /usr/bin/phar.phar7.3 to provide /usr/bin/phar.phar (phar.phar) in auto mode

Creating config file /etc/php/7.3/cli/php.ini with new version
Setting up php7.3-fpm (7.3.11-0ubuntu0.19.10.4) ...

Creating config file /etc/php/7.3/fpm/php.ini with new version
NOTICE: Not enabling PHP 7.3 FPM by default.
NOTICE: To enable PHP 7.3 FPM in Apache2 do:
NOTICE: a2enmod proxy_fcgi setenvif
NOTICE: a2enconf php7.3-fpm
NOTICE: You are seeing this message because you have apache2 package installed.
Created symlink /etc/systemd/system/multi-user.target.wants/php7.3-fpm.service → /lib/systemd/system/php7.3-fpm.service.
Job for php7.3-fpm.service failed because the control process exited with error code.
See "systemctl status php7.3-fpm.service" and "journalctl -xe" for details.
invoke-rc.d: initscript php7.3-fpm, action "start" failed.
● php7.3-fpm.service - The PHP 7.3 FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php7.3-fpm.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2020-05-10 12:26:13 CEST; 14ms ago
     Docs: man:php-fpm7.3(8)
  Process: 30288 ExecStart=/usr/sbin/php-fpm7.3 --nodaemonize --fpm-config /etc/php/7.3/fpm/php-fpm.conf (code=exited, status=127)
 Main PID: 30288 (code=exited, status=127)

May 10 12:26:13 vps819983 systemd[1]: Starting The PHP 7.3 FastCGI Process Manager...
May 10 12:26:13 vps819983 php-fpm7.3[30288]: /usr/sbin/php-fpm7.3: symbol lookup error: /usr/sbin/php-fpm7.3: undefined symbol: crypto_pwhash_scryptsalsa208sha256_memlimit_interactive
May 10 12:26:13 vps819983 systemd[1]: php7.3-fpm.service: Main process exited, code=exited, status=127/n/a
May 10 12:26:13 vps819983 systemd[1]: php7.3-fpm.service: Failed with result 'exit-code'.
May 10 12:26:13 vps819983 systemd[1]: Failed to start The PHP 7.3 FastCGI Process Manager.
dpkg: error processing package php7.3-fpm (--configure):
 installed php7.3-fpm package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of php-fpm:
 php-fpm depends on php7.3-fpm; however:
  Package php7.3-fpm is not configured yet.

dpkg: error processing package php-fpm (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Processing triggers for man-db (2.8.7-3) ...
Processing triggers for systemd (242-7ubuntu3.7) ...
Errors were encountered while processing:
 php7.3-fpm
 php-fpm
E: Sub-process /usr/bin/dpkg returned an error code (1)

Tried php7.2 (with ppa) and 7.3 : same error

Any ideas please ?

EDIT: ldd command

root@vps:~# ldd /usr/sbin/php-fpm7.4
        linux-vdso.so.1 (0x00007ffe9d1cb000)
        libargon2.so.1 => /lib/x86_64-linux-gnu/libargon2.so.1 (0x00007fac1ed7e000)
        libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007fac1ed62000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fac1ec13000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fac1ec0d000)
        libapparmor.so.1 => /lib/x86_64-linux-gnu/libapparmor.so.1 (0x00007fac1ebf8000)
        libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007fac1eb4b000)
        libxml2.so.2 => /lib/x86_64-linux-gnu/libxml2.so.2 (0x00007fac1e98f000)
        libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fac1e8fc000)
        libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fac1e626000)
        libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007fac1e596000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fac1e57a000)
        libsodium.so.23 => /usr/local/lib/libsodium.so.23 (0x00007fac1e52b000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fac1e337000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fac1e314000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fac1f23a000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fac1e309000)
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fac1e2e2000)
        liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007fac1e2c1000)
        libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007fac1e1a3000)
        libicuuc.so.66 => /lib/x86_64-linux-gnu/libicuuc.so.66 (0x00007fac1dfbb000)
        libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007fac1df98000)
        libicudata.so.66 => /lib/x86_64-linux-gnu/libicudata.so.66 (0x00007fac1c4d7000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fac1c2f6000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fac1c2db000)

Best Answer

Install the official libsodium23 iso the one in /usr/local.