Skip to main content
Links updated for latest stable release packeges and added phpize command
Source Link

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 librarySodium 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://github.com/jedisct1/libsodiumhttps://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

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.

--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://github.com/jedisct1/libsodium

//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>

./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

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

Source Link

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.

--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://github.com/jedisct1/libsodium

//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>

./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