Introduction
The overall process has two main steps:
Step 1 - Install the base libsodium library via your server's package manager. (yum, dnf, apt)
Step 2 - Use one of the below procedures corresponding to your version of PHP to install the PHP extension for Sodium.
Step 1 - Installing The Base Sodium Library (libsodium)
CentOS 7 & CloudLinux 7
- Login to the server via SSH or Terminal as the root user
- Install the EPEL repository with the following command:
yum install epel-release
- Install the Sodium library and companion development package with the following command:
yum install libsodium libsodium-devel
AlmaLinux 8 & CloudLinux 8
- Login to the server via SSH or Terminal as the root user
- Install the Sodium library and companion development package with the following command:
dnf install libsodium libsodium-devel
Ubuntu 20.04 LTS
- Login to the server via SSH or Terminal as the root user
- Install the Sodium library and companion development package with the following command:
apt install libsodium-dev libsodium23
Step 2 - Install the PHP Extension for ea-php74 and Newer via WHM
ea-php74 and Newer via EasyApache in WHM
- Login to WHM as the root user
- Navigate to: Home » Software » EasyApache 4
- Click the blue "Customize" button
- Click the "PHP Extensions" link in the left sidebar
- Enter libsodium into the search box
- Toggle the libsodium extension so that it turns blue for each desired version of PHP
- Click the "Review" link in the left sidebar
- Scroll to the bottom of the page and click the blue "Provision" button
- Optionally create a PHP Info script to verify that the extensions are available on your website:
How to use a PHPInfo Script for Troubleshooting PHP Issues
ea-php73 and Older via PECL on the Command Line
Please note, older versions of ea-php are not available on AlmaLinux, CloudLinux 8 and Ubuntu
- 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 | grep -E "(5[4-6])|(7[0-3])"
- Choose the PECL binary path that matches your desired PHP version, and install the libsodium extension. The following example uses PHP 7.3
/opt/cpanel/ea-php73/root/usr/bin/pecl install libsodium
- Optionally create a PHP Info script to verify that the extensions are available on your website:
How to use a PHPInfo Script for Troubleshooting PHP Issues