Verify php and pecl version
php -v
pecl version
If you don’t have the PECL package manager installed on your system, make sure you do that first.
sudo apt install php7.4-dev
sudo pecl channel-update pecl.php.net
sudo apt install php-pear
Install libsodium extension
sudo pecl install -f libsodium
After success installing libsodium trought pecl, you should add sodium.so extension to php.ini.
sudo echo "extension = sodium.so" > /etc/php/7.4/mods-available/sodium.ini
Nota: in functie de versiunea php inlocuiti in comanda 7.4 cu 7.3, 7.2 sau 7.1
sudo phpenmod sodium
Verify that the extension was installed
php -i | grep "sodium"
The output will look like this:
/etc/php/7.1/cli/conf.d/ext-libsodium.ini, libsodium libsodium support => enabled libsodium compiled version => 2.0.10