wdcp一键开启php_ioncube加密扩展

# 1、一键开启 # 2、自适应php5.2-php7.0 # 3、自适应apache、nginx及系统版本

#!/bin/bash
#######################################################

$Name: ioncube.sh

$Version: v1.0

$Function: wdcp一键开启php_ioncube加密扩展

$Author: Ropon

$organization: west.cn

$Create Date: 2017-3-10

$Description: 1、一键开启

2、自适应php5.2-php7.0

3、自适应apache、nginx及系统版本

#######################################################

php_install_dir=/www/wdlinux/php
PHP_version=`$php_install_dir/bin/php -r ‘echo PHP_VERSION;’`
Ver=${PHP_version%.*}

if [ “$(getconf WORD_BIT)” == “32” ] && [ “$(getconf LONG_BIT)” == “64” ]; then
OS_BIT=64
else
OS_BIT=32
fi
inifile=`$php_install_dir/bin/php -inigrep ‘php.ini’awk ‘{print $6}’`/php.ini
temp=`grep -E ‘\[ionCube Loader\]‘ $inifile`

if [ ! -n “$temp” ] ;then
if [ ! -f ioncube_loader_lin.so ];then
case “${OS_BIT}” in
64)
wget -O ioncube_loader_lin.so -c http://download.myhostadmin.net/php/ioncube/ioncube\_loader\_lin\_${Ver}.so
;;
32)
wget -O ioncube_loader_lin.so -c http://download.myhostadmin.net/php/ioncube/ioncube\_loader\_lin\_x86\_${Ver}.so
;;
*)
echo “Error!”
exit 1
;;
esac
fi
[ ! -d “`$php_install_dir/bin/php-config –extension-dir`“ ] && mkdir -p `$php_install_dir/bin/php-config –extension-dir`
/bin/cp ioncube_loader_lin.so `$php_install_dir/bin/php-config –extension-dir`
zend_extension=”`$php_install_dir/bin/php-config –extension-dir`/ioncube_loader_lin.so”
rm -rf ioncube_loader_lin.so
sed -i “/^\[PHP/i\[ionCube Loader]“ $inifile
sed -i “/^\[ionCube/a\zend_extension=$zend_extension” $inifile
num=`ps -efgrep -w “nginx”grep -v grepwc -l`
if [ ${num} -eq 0 ] ;then
service httpd restart
else
service httpd restart
service php-fpm restart
fi
echo
echo “ioncube install is OK”
echo
else
echo
echo “Error! ioncube install is OK?”
echo
exit 1
fi