Contents

php容器内安装SG11扩展

查看PHP_VERSION

php -v | head -n1 | cut -d' ' -f2 | cut -d. -f1-2

安装

mkdir -p /tmp/sourceguardian && cd /tmp/sourceguardian

curl -Os https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz

tar xzf loaders.linux-x86_64.tar.gz

cp ixed.${PHP_VERSION}.lin "$(php -i | grep '^extension_dir =' | cut -d' ' -f3)/sourceguardian.so"

echo "extension=sourceguardian.so" > /usr/local/etc/php/conf.d/15-sourceguardian.ini

rm -rf /tmp/sourceguardian

重启容器&验证

<?php
echo phpinfo();

https://qn.chenzqi.cn/blog/202307061845843.png