标签:pre 修改 mic for libiconv class make 模块 mirror
安装libsodium
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
或者直接yum安装
rpm -ivh http://mirrors.whsir.com/centos/whsir-release-centos.noarch.rpm yum install wlibsodium
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
注意:此处编译的路径是 /opt/php-7.2.17/ext/sodium
执行完成后会显示扩展模块编译到的目录/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/" extension=sodium.so
保存退出,重启php
通过phpinfo可看到,扩展已生效
附:如果在编译时报错:
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor‘: /ext/iconv/iconv.c:2491: undefined reference to `libiconv_open‘ collect2: ld returned 1 exit status make: *** [sapi/cli/php] Error 1
解决方法:
使用:make ZEND_EXTRA_LIBS=‘-liconv‘
或者: vim Makefile
添加:-lcrypt
然后重新编译
标签:pre 修改 mic for libiconv class make 模块 mirror
原文地址:https://www.cnblogs.com/new-journey/p/11927678.html