I am using xampp and it's php version is 7.3.27. I am trying to install magento version-2.4.2 in ubuntu linux. But i am facing this problem. I have found several solution to install libosodium extension on internet to solve this problem. But it is not clear, how to install it in xampp php folder, not in the usr/bin/php folder. Because i am using xampp php as default php.
This error occurs with Magento 2.4.2 when php does not include the
sodium php extension.
You can check if this extension is installed with
php -i | grep sodium sodium support => enabled libsodium headers version => 1.0.16
To fix this problem install / activate the
sodium php extension.
For Xampp in
php.ini add (or uncomment)
sudo apt install php-libsodium
NOTE the supported PHP version for Magento 2.4 is PHP 7.4
While installing Magento 2.4.2 this error occurs which indicates your PHP and Apache do not have "Sodium" extension ON.
For WAMP or WAMP64 users, you will need to remove ";" infront of extension=sodium line written in wamp64\bin\apache\apache2.4.41\bin\php.ini and
then it would be worked.
This answer is only for Linux(Ubuntu) users
There is default PHP installed as a system package but if you are using self contained installation of PHP (XAMPP [Binami]) then you have to provide php-config path in following attribute of
./configure command while installing the LIBSODIUM for your PHP.
/opt/lampp/etc/php -m //Check if you have sodium installed sudo apt-get update sudo apt-get install build-essential libtool autoconf
Download stable version of Sodium Library by following link
//Go inside the package folder cd <downloaded package dir> ./configure make sudo make install
It will install library and you can check inside the
/usr/local/lib/. The file for libsodium has been created with so extension.
Now we will download and install PHP library for
//Go inside the package folder
cd <downloaded package dir> phpize // This will create configure script. ./configure --with-php-config=/opt/lampp/bin/php-config //This time we provided preferred php config make sudo make install
This will isntall extension for XAMPP PHP and you can check
sodium.so file has been created inside
Add extension inside php.ini
sudo bash -c 'echo "extension="sodium.so"" >> /opt/lampp/etc/php.ini'
Restart XAMPP and check installed php modules
sudo /opt/lampp/lampp restart /opt/lampp/etc/php -m
If all works fine then you will find sodium in list defiantly.