Centos7.9+PHP7.4安装sodium过程实践笔记
Step1、下载编译安装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
make && make check
sudo make install
sudo ldconfig
Step2、下载编译安装sodium
yum install autoconf
wget https://www.php.net/distributions/php-7.4.19.tar.gz
tar xf php-7.4.19.tar.gz
cd php-7.4.19/ext/sodium
#核对导入/usr/lib/pkgconfig路径
echo $PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
echo $PKG_CONFIG_PATH
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
Step3、修改php.ini添加扩展
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20190902/"
extension=sodium.so