82 lines
2.7 KiB (Stored with Git LFS)
Bash
82 lines
2.7 KiB (Stored with Git LFS)
Bash
#!/bin/bash
|
|
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
|
|
|
|
source <(curl -f -s --connect-timeout 10 --retry 3 https://dl.cdn.haozi.net/panel/public.sh)
|
|
if [ $? -ne 0 ]; then
|
|
echo "下载 public.sh 失败,请检查网络或稍后重试。"
|
|
echo "Download public.sh failed, please check the network or try again later."
|
|
exit 1
|
|
fi
|
|
|
|
action=${1}
|
|
version=${2}
|
|
php_path="${setup_path}/server/php/${version}"
|
|
igbinary_version="3.2.15"
|
|
|
|
Install() {
|
|
# 检查是否已经安装
|
|
is_install=$(cat ${php_path}/etc/php.ini | grep '^extension=igbinary')
|
|
if [ "${is_install}" != "" ]; then
|
|
error "PHP-${version} 已安装 igbinary"
|
|
fi
|
|
|
|
cd ${php_path}/src/ext
|
|
rm -rf igbinary
|
|
wget --retry-connrefused --retry-on-host-error --retry-on-http-error=429,500,502,503,504 -t 10 -T 120 -O igbinary-${igbinary_version}.zip ${download_url}/php_exts/igbinary-${igbinary_version}.zip
|
|
wget --retry-connrefused --retry-on-host-error --retry-on-http-error=429,500,502,503,504 -t 10 -T 120 -O igbinary-${igbinary_version}.zip.sha256 ${download_url}/php_exts/igbinary-${igbinary_version}.zip.sha256
|
|
|
|
if ! sha256sum --status -c igbinary-${igbinary_version}.zip.sha256; then
|
|
rm -f igbinary-${igbinary_version}.zip
|
|
rm -f igbinary-${igbinary_version}.zip.sha256
|
|
error "PHP-${version} igbinary 校验失败"
|
|
fi
|
|
|
|
unzip igbinary-${igbinary_version}.zip
|
|
rm -f igbinary-${igbinary_version}.zip
|
|
mv igbinary-${igbinary_version} igbinary
|
|
rm -f igbinary-${igbinary_version}.zip
|
|
rm -f igbinary-${igbinary_version}.zip.sha256
|
|
cd igbinary
|
|
${php_path}/bin/phpize
|
|
./configure --with-php-config=${php_path}/bin/php-config
|
|
make
|
|
if [ "$?" != "0" ]; then
|
|
rm -rf ${php_path}/src/ext/igbinary
|
|
error "PHP-${version} igbinary 编译失败"
|
|
fi
|
|
make install
|
|
if [ "$?" != "0" ]; then
|
|
rm -rf ${php_path}/src/ext/igbinary
|
|
error "PHP-${version} igbinary 安装失败"
|
|
fi
|
|
|
|
sed -i '/;panel/a\extension=igbinary' ${php_path}/etc/php.ini
|
|
|
|
# 重载PHP
|
|
systemctl reload php-fpm-${version}.service
|
|
echo -e $HR
|
|
echo "PHP-${version} igbinary 安装成功"
|
|
}
|
|
|
|
Uninstall() {
|
|
# 检查是否已经安装
|
|
is_install=$(cat ${php_path}/etc/php.ini | grep '^extension=igbinary$')
|
|
if [ "${is_install}" == "" ]; then
|
|
error "PHP-${version} 未安装 igbinary"
|
|
fi
|
|
|
|
sed -i '/extension=igbinary/d' ${php_path}/etc/php.ini
|
|
|
|
# 重载PHP
|
|
systemctl reload php-fpm-${version}.service
|
|
echo -e $HR
|
|
echo "PHP-${version} igbinary 卸载成功"
|
|
}
|
|
|
|
if [ "$action" == 'install' ]; then
|
|
Install
|
|
fi
|
|
if [ "$action" == 'uninstall' ]; then
|
|
Uninstall
|
|
fi
|