Home >Backend Development >PHP7 >php7 install sodium extension

php7 install sodium extension

藏色散人
藏色散人forward
2019-05-09 09:28:0511743browse

php7 install sodium extension

Currently using Centos7.x system, PHP uses version 7.2

Install libsodium

libsodium is necessary to install the sodium extension Dependency conditions, I provide two installation methods here, compile and directly yum

compile and install libsodium

wget https://github.com/jedisct1/libsodium/releases/download/1.0.17/libsodium-1.0.17.tar.gz
tar xf libsodium-1.0.17.tar.gz
cd libsodium-1.0.17
./configure
make
make install

yum install libsodium

rpm -ivh http://mirrors.whsir.com/centos/whsir-release-centos.noarch.rpm
yum install wlibsodium

Download php7.2 and compile sodium

yum install autoconf
wget https://www.php.net/distributions/php-7.2.17.tar.gz
tar xf php-7.2.17.tar.gz
cd php-7.2.17/ext/sodium
/usr/local/php/bin/phpize

Just run it according to the location of your phpize (if you don’t know where phpize is, just find / -name phpize to search), and you will get a prompt after running The following information, and then compile

Configuring for:
PHP Api Version: 20170718
Zend Module Api No: 20170718
Zend Extension Api No: 320170718

Compile the extension module:

./configure --with-php-config=/usr/local/php/bin/php-config
make
make install

After the execution is completed, the directory where the extension module is compiled will be displayed/usr/local/php/lib/php /extensions/no-debug-non-zts-20170718/

Modify php.ini to add extension

extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/"
extension=sodium.so

Save and exit, restart php.

You can see through phpinfo that the extension has taken effect.

The above is the detailed content of php7 install sodium extension. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:aliyun.com. If there is any infringement, please contact admin@php.cn delete
Previous article:Data types in PHP7Next article:Data types in PHP7