【发布时间】:2019-05-24 12:17:27
【问题描述】:
我在 PHP 7.1.25 中,mcrypt 是当前使用的扩展,mcrypt 将在 PHP 7.2 中被弃用,Libsodium 将被添加到 PHP 7.2 的核心扩展中
现在我需要尝试在 PHP 7.1 中安装 libsodium 并查看它是如何工作的,遵循此 https://lukasmestan.com/install-libsodium-extension-in-php7 但安装失败。也更新了 PECL 包。请参阅下面的错误!
任何帮助将不胜感激。提前致谢!
$ sudo pecl install -f libsodium
downloading libsodium-2.0.20.tgz ...
Starting to download libsodium-2.0.20.tgz (28,504 bytes)
.........done: 28,504 bytes
4 source files, building
running: phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
building in /tmp/pear/temp/pear-build-rootsL5uMO/libsodium-2.0.20
running: /tmp/pear/temp/libsodium/configure --with-php-config=/usr/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20160303 -I/usr/include/php/20160303/main -I/usr/include/php/20160303/TSRM -I/usr/include/php/20160303/Zend -I/usr/include/php/20160303/ext -I/usr/include/php/20160303/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20160303
checking for PHP installed headers prefix... /usr/include/php/20160303
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for sodium support... yes, shared
checking for pkg-config... no
checking for libsodium... configure: error: Please install libsodium - See https://github.com/jedisct1/libsodium
ERROR: `/tmp/pear/temp/libsodium/configure --with-php-config=/usr/bin/php-config' failed
【问题讨论】:
-
"configure: error: Please install libsodium - See github.com/jedisct1/libsodium" 看起来相当简单,但您没有提及它。您是否安装了库但扩展构建系统找不到它?您是否在询问有关如何安装库的说明?
-
试试这个替代方法 openssl_encrypt stackoverflow.com/questions/41272257/…
-
感谢您的评论。我对按照lukasmestan.com/install-libsodium-extension-in-php7 安装库感到困惑。需要有关如何安装和配置库的说明