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.
4 Answers
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)
extension=sodium;
Or
sudo apt install php-libsodium
NOTE the supported PHP version for Magento 2.4 is PHP 7.4
-
I am using xampp . In which folder i should install libosodium? And how to install it? I am a beginner in ubuntu, can you help me?– JawadCommented Mar 3, 2021 at 6:29
-
-
I've faced with this issue on Fedora 34. Command "dnf -y install php74-php-libsodium" to install sodium extension helped. Commented Jun 28, 2023 at 9:53
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
wamp64\bin\php\phpX.X.x\php.ini
then it would be worked.
This answer is only for Linux(Ubuntu) users
++ Updated
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.
--with-php-config
I have installed xampp-linux-x64-7.4.15-0 and surprisingly there is no sodium PHP module in this setup. I installed Sodium library first and then install PHP Libsodium extesnion for XAMPP.
/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
https://download.libsodium.org/libsodium/releases/ libsodium-1.x.x-stable.tar.gz
//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
https://github.com/jedisct1/libsodium-php
//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 /opt/lampp7.4/lib/php/extensions/no-debug-non-zts-2019****
.
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.
CHEERS
-
Hi Kapil I'm trying to configure this setup in my xampp server First step completed. but not able to get ./configure command in this php library package folder(as you suggested) github.com/jedisct1/libsodium-php Can you suggest How I can fix– MankeshCommented Apr 5, 2021 at 10:51
-
Please share what errors are you getting when you execute ./configure cmd Commented Apr 7, 2021 at 4:01
-
First I have cloned the codes from github.com/jedisct1/libsodium-php Then I'm going to this(libsodium-php) directory And executing this ./configure --with-php-config=/opt/lampp/bin/php-config command then I'm getting this error bash: ./configure: No such file or directory ---------------- Because there is no any file from configure name ---------------- Can you suggest how will I execute these commands.– MankeshCommented Apr 8, 2021 at 5:16
-
-
There are 4 solutions to resolve this error on WINDOWS XAMPP.
Solution 1:-
One of the reason for this error is sodium extension not enabled in php.ini file, so we need to enable it and re-run install command in the command prompt.
To enable:-
Go to C:\xampp\php\php.ini, find "extension=sodium" in it and then remove semicolon from beginning of this line to enable PHP extensions sodium. Save the file.
Then restart Apache means stop and start Apache from the Xampp Control Panel.
That’s it.