php74 安装扩展sodium
1. 下载编译安装libsodium
wget https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz tar -zxf libsodium-1.0.18-stable.tar.gz cd libsodium-stable ./configure --prefix=/usr/local/libsodium make && make check make install
2. 下载编译安装sodium
yum install autoconf php -v wget https://www.php.net/distributions/php-7.4.21.tar.gz tar -zxf php-7.4.21.tar.gz cd php-7.4.21/ext/sodium/
核对导入lib/pkgconfig路径
echo $PKG_CONFIG_PATH export PKG_CONFIG_PATH=/usr/local/libsodium/lib/pkgconfig/ echo $PKG_CONFIG_PATH
phpize ./configure --with-php-config=/usr/local/php/bin/php-config make make install
3. 修改php.ini添加扩展
vim /usr/local/php/etc/php.ini extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20190902/" extension=sodium.so :wq systemctl restart php-fpm php -m | grep sodium