How to install the libsodium cryptographic library and PHP extension on cPanel

Help | Dedicated Servers

Procedure

1. Login to the server via SSH or Terminal as the root user

 

2. If you do not yet already have the EPEL repository installed, you must install it. If you are using CentOS 7 you may use the following command:

 

yum -y install epel-release

Other operating systems may require different steps to install the EPEL repository.

 

3.  Issue the following command to install the required libraries:

 

yum install libsodium libsodium-devel -y

 

4.  Next, you can use either install the PHP extension via WHM or the command line

 

Install the libsodium PHP extension via the command line

- Login to the server via SSH or Terminal as the root user

 

- Issue the following command to find the PECL binaries for each version of PHP you have installed:

 

find /opt/cpanel/ -iname pecl | grep bin

- Issue the command to install the extension, modifying the path to the binary based on which version of PHP you want to install the extension for:

 

/opt/cpanel/ea-php74/root/usr/bin/pecl install libsodium

 

Install the libsodium PHP extension via WHM

 

- Login to WHM as the root user

 

- Navigate to: Home »Software »Module Installers

 

- Click the Manage link for PHP PECL

 

- Select your desired version of PHP from the drop-down and click the blue Apply button

 

- Put libsodium into the box under "Install a PHP PECL"

 

- Click the blue Install button

 

Verifying that the extension is loaded

You can verify that the extension is loaded by creating a PHP Info file and then examining the result. 

Need help? Contact us