This commit is contained in:
71
php_exts/igbinary.sh
Normal file
71
php_exts/igbinary.sh
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/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.acepanel.net/public.sh)
|
||||
if [ $? -ne 0 ]; then
|
||||
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.17RC1"
|
||||
|
||||
Install() {
|
||||
# 检查是否已经安装
|
||||
is_install=$(cat ${php_path}/etc/php.ini | grep '^extension=igbinary')
|
||||
if [ "${is_install}" != "" ]; then
|
||||
error "PHP-${version} igbinary already installed"
|
||||
fi
|
||||
|
||||
cd ${php_path}/src/ext
|
||||
rm -rf igbinary
|
||||
dl "${php_path}/src/ext" "/php_exts/igbinary-${igbinary_version}.zip"
|
||||
|
||||
unzip igbinary-${igbinary_version}.zip
|
||||
mv igbinary-${igbinary_version} igbinary
|
||||
rm -f igbinary-${igbinary_version}.zip
|
||||
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 compilation failed"
|
||||
fi
|
||||
make install
|
||||
if [ "$?" != "0" ]; then
|
||||
rm -rf ${php_path}/src/ext/igbinary
|
||||
error "PHP-${version} igbinary installation failed"
|
||||
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 installation successful"
|
||||
}
|
||||
|
||||
Uninstall() {
|
||||
# 检查是否已经安装
|
||||
is_install=$(cat ${php_path}/etc/php.ini | grep '^extension=igbinary$')
|
||||
if [ "${is_install}" == "" ]; then
|
||||
error "PHP-${version} igbinary not installed"
|
||||
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 uninstall successful"
|
||||
}
|
||||
|
||||
if [ "$action" == 'install' ]; then
|
||||
Install
|
||||
fi
|
||||
if [ "$action" == 'uninstall' ]; then
|
||||
Uninstall
|
||||
fi
|
||||
Reference in New Issue
Block a user