Installing Libsodium and Pecl-libsodium on Centos7 and Php7

If you would like to work with state of the art encryption techniques in your PHP project then you need to check out libsodium and the corresponding PHP library, pecl-libsodium

Getting it installed on your centos7 and PHP7 box though can be a little tricky

Here is a bash script which will install all the required depencies and get it working:

#!/usr/bin/env bash

if [[ "$(whoami)" != "root" ]]
then
    echo "please run this as root"
    exit 1
fi

yum install \
    php70w-pear \
    php70w-devel \
    gcc \
    curl-devel \
    libsodium \
    libsodium-devel

pecl install libsodium

echo "extension=libsodium.so" >> /etc/php.ini

php -i | grep sodium

With this package you can now do all kinds of enterprise level cryptography, suggest you have a read of this documentation


Tags: phpphp7encryptionlibsodiumpecl-libsodiumcentos