php7 install sodium extension

藏色散人
Release: 2023-02-17 12:24:01
forward
11475 people have browsed it

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
Copy after login

yum install libsodium

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

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
Copy after login

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
Copy after login

Compile the extension module:

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

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
Copy after login

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!

Related labels:
source:aliyun.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!