51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

php7安装sodium扩展

文章目录

当前使用Centos7.x系统,php使用7.2版本,whsir一键包已支持该扩展

安装libsodium {#title-0}

libsodium是安装sodium扩展的必须依赖条件,我这里提供两种安装方式,编译和直接yum

编译安装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

|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 5 6 | 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安装libsodium
rpm -ivh http://mirrors.wlnmp.com/centos/whsir-release-centos.noarch.rpm yum install wlibsodium

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


下载php7.2编译sodium {#title-1}


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

|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 2 3 4 5 | 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 |

根据自己phpize的位置来运行即可(不知道phpize在哪的直接find / -name phpize查找),运行完提示下面信息,然后编译

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

编译扩展模块:
./configure --with-php-config=/usr/local/php/bin/php-config make make install

|-------|-------------------------------------------------------------------------------| | 1 2 3 | ./configure --with-php-config=/usr/local/php/bin/php-config make make install |

执行完成后会显示扩展模块编译到的目录/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/

修改php.ini添加扩展 {#title-2}


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

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

保存退出,重启php

通过phpinfo可看到,扩展已生效


赞(0)
未经允许不得转载:工具盒子 » php7安装sodium扩展