#!/Bashblog.net

Libsodium on PHP 7.x

Categories: [Applications]

In order to install libsodium (cryptography library) on PHP 7.4 with FPM, follow these steps:

  1. Install phpize, libsodium and php-pear (PECL):

apt install php7.4-dev libsodium-dev php-pear

  1. Use PECL to install libsodium:

pecl channel-update pecl.php.net pecl install -f libsodium

  1. Inject into php.ini:

echo "extension = /usr/lib/php/20190902/sodium.so" >> /etc/php/7.4/fpm/php.ini && systemctl restart php7.4-fpm

Enjoy.

« Previous Next »