Introduction
This article provides the steps needed to install the Sodium Cryptographic Library (libsodium) and PHP Extension on CentOS 7 and CloudLinux 7.
Procedure
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Use the
yum
command to install the EPEL repository if it has not already been installed.yum install epel-release
- Use the
yum
command to install the Sodium library and companion development package.yum install libsodium libsodium-devel
- Install the libsodium PHP extension.
- To install the PHP extension for ea-php74 and newer:
- Login to WHM as the 'root' user.
- Navigate to "Home / Software / EasyApache 4."
- In the "Currently Installed Packages" section, click the "Customize" button.
- Click the "PHP Extensions" link in the left sidebar
- Enter "libsodium" into the search box.
- Toggle the libsodium extension for each desired version of PHP.
- Click the "Review" link in the left sidebar.
- Scroll to the bottom of the page and click the "Provision" button.
- To install the PHP extension for ea-php74 and newer:
- To install the PHP extension for ea-php73 and older:
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Run 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.
/opt/cpanel/ea-php73/root/usr/bin/pecl install libsodium
Please note that in the above example uses PHP 7.3. Replace ea-php73 with the desired PHP version.