mirror of https://github.com/midoks/mdserver-web
pull/109/head
parent
4ed198e952
commit
9d6c8f21b1
@ -0,0 +1,117 @@ |
||||
#!/bin/bash |
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||
export PATH |
||||
|
||||
curPath=`pwd` |
||||
rootPath=$(dirname "$curPath") |
||||
rootPath=$(dirname "$rootPath") |
||||
serverPath=$(dirname "$rootPath") |
||||
sourcePath=${serverPath}/source |
||||
sysName=`uname` |
||||
install_tmp=${rootPath}/tmp/mw_install.pl |
||||
|
||||
|
||||
version=5.2.17 |
||||
PHP_VER=52 |
||||
Install_php() |
||||
{ |
||||
#------------------------ install start ------------------------------------# |
||||
echo "安装php-${version} ..." > $install_tmp |
||||
mkdir -p $sourcePath/php |
||||
mkdir -p $serverPath/php |
||||
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];then |
||||
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then |
||||
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz http://au1.php.net/distributions/php-${version}.tar.xz |
||||
fi |
||||
|
||||
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz |
||||
mv $sourcePath/php/php-${version} $sourcePath/php/php${PHP_VER} |
||||
fi |
||||
|
||||
|
||||
if [ -f $serverPath/php/53/bin/php.dSYM ];then |
||||
mv $serverPath/php/53/bin/php.dSYM $serverPath/php/53/bin/php |
||||
fi |
||||
|
||||
if [ -f $serverPath/php/53/sbin/php-fpm.dSYM ];then |
||||
mv $serverPath/php/53/sbin/php-fpm.dSYM $serverPath/php/53/sbin/php-fpm |
||||
fi |
||||
|
||||
|
||||
if [ -f $serverPath/php/53/bin/php ];then |
||||
return |
||||
fi |
||||
|
||||
OPTIONS='' |
||||
if [ $sysName == 'Darwin' ]; then |
||||
OPTIONS='--without-iconv' |
||||
OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype" |
||||
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl" |
||||
else |
||||
OPTIONS="--with-iconv=${serverPath}/lib/libiconv" |
||||
OPTIONS="${OPTIONS} --with-freetype-dir=${serverPath}/lib/freetype" |
||||
OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf" |
||||
OPTIONS="${OPTIONS} --with-curl" |
||||
fi |
||||
|
||||
|
||||
if [ ! -d $serverPath/php/53 ];then |
||||
cd $sourcePath/php/php${PHP_VER} && ./configure \ |
||||
--prefix=$serverPath/php/53 \ |
||||
--exec-prefix=$serverPath/php/53 \ |
||||
--with-config-file-path=$serverPath/php/53/etc \ |
||||
--with-zlib-dir=$serverPath/lib/zlib \ |
||||
--enable-zip \ |
||||
--enable-exif \ |
||||
--enable-hash \ |
||||
--enable-libxml \ |
||||
--enable-simplexml \ |
||||
--enable-dom \ |
||||
--enable-filter \ |
||||
--enable-fileinfo \ |
||||
--enable-pcntl \ |
||||
--enable-bcmath \ |
||||
--enable-xml \ |
||||
--enable-ftp \ |
||||
--enable-soap \ |
||||
--enable-posix \ |
||||
--enable-sockets \ |
||||
--enable-mbstring \ |
||||
--enable-mysqlnd \ |
||||
--enable-sysvmsg \ |
||||
--enable-sysvsem \ |
||||
--enable-sysvshm \ |
||||
--disable-fileinfo \ |
||||
$OPTIONS \ |
||||
--enable-fpm \ |
||||
&& make && make install && make clean |
||||
fi |
||||
|
||||
|
||||
if [ -f $serverPath/php/53/bin/php.dSYM ];then |
||||
mv $serverPath/php/53/bin/php.dSYM $serverPath/php/53/bin/php |
||||
fi |
||||
|
||||
if [ -f $serverPath/php/53/sbin/php-fpm.dSYM ];then |
||||
mv $serverPath/php/53/sbin/php-fpm.dSYM $serverPath/php/53/sbin/php-fpm |
||||
fi |
||||
|
||||
#------------------------ install end ------------------------------------# |
||||
} |
||||
|
||||
|
||||
|
||||
Uninstall_php() |
||||
{ |
||||
$serverPath/php/init.d/php53 stop |
||||
rm -rf $serverPath/php/53 |
||||
echo "uninstall php-5.3.29 ..." > $install_tmp |
||||
} |
||||
|
||||
action=${1} |
||||
if [ "${1}" == 'install' ];then |
||||
Install_php |
||||
else |
||||
Uninstall_php |
||||
fi |
@ -0,0 +1,101 @@ |
||||
#!/bin/bash |
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||
export PATH |
||||
|
||||
curPath=`pwd` |
||||
|
||||
rootPath=$(dirname "$curPath") |
||||
rootPath=$(dirname "$rootPath") |
||||
rootPath=$(dirname "$rootPath") |
||||
rootPath=$(dirname "$rootPath") |
||||
serverPath=$(dirname "$rootPath") |
||||
sourcePath=${serverPath}/source/php |
||||
|
||||
LIBNAME=ZendGuardLoader |
||||
|
||||
sysName=`uname` |
||||
actionType=$1 |
||||
version=$2 |
||||
extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20090626/${LIBNAME}.so |
||||
|
||||
if [ "$sysName" == "Darwin" ];then |
||||
BAK='_bak' |
||||
else |
||||
BAK='' |
||||
fi |
||||
|
||||
Install_lib() |
||||
{ |
||||
|
||||
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"` |
||||
if [ "${isInstall}" != "" ];then |
||||
echo "php-$version 已安装${LIBNAME},请选择其它版本!" |
||||
return |
||||
fi |
||||
|
||||
if [ ! -f "$extFile" ];then |
||||
|
||||
php_lib=$sourcePath/php_lib |
||||
mkdir -p $php_lib |
||||
|
||||
if [ $sysName == 'Darwin' ]; then |
||||
wget -O $php_lib/zend-loader-php5.3.tar.gz http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-darwin-i386.tar.gz |
||||
else |
||||
wget -O $php_lib/zend-loader-php5.3.tar.gz http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz |
||||
fi |
||||
|
||||
cd $php_lib && tar xvf zend-loader-php5.3.tar.gz |
||||
cd ZendGuardLoader-php* && cd php-5.3.x |
||||
cp ZendGuardLoader.so $serverPath/php/$version/lib/php/extensions/no-debug-non-zts-20090626/ |
||||
|
||||
fi |
||||
|
||||
if [ ! -f "$extFile" ];then |
||||
echo "ERROR!" |
||||
return |
||||
fi |
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini |
||||
echo "[Zend ZendGuard Loader]" >> $serverPath/php/$version/etc/php.ini |
||||
echo "zend_extension=ZendGuardLoader.so" >> $serverPath/php/$version/etc/php.ini |
||||
echo "zend_loader.enable=1" >> $serverPath/php/$version/etc/php.ini |
||||
echo "zend_loader.disable_licensing=0" >> $serverPath/php/$version/etc/php.ini |
||||
echo "zend_loader.obfuscation_level_support=3" >> $serverPath/php/$version/etc/php.ini |
||||
echo "zend_loader.license_path=" >> $serverPath/php/$version/etc/php.ini |
||||
|
||||
$serverPath/php/init.d/php$version reload |
||||
echo '===========================================================' |
||||
echo 'successful!' |
||||
} |
||||
|
||||
|
||||
Uninstall_lib() |
||||
{ |
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then |
||||
echo "php$version 未安装,请选择其它版本!" |
||||
return |
||||
fi |
||||
|
||||
if [ ! -f "$extFile" ];then |
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!" |
||||
return |
||||
fi |
||||
|
||||
sed -i $BAK "/ZendGuardLoader.so/d" $serverPath/php/$version/etc/php.ini |
||||
sed -i $BAK "/zend_loader/d" $serverPath/php/$version/etc/php.ini |
||||
sed -i $BAK "/\[Zend ZendGuard Loader\]/d" $serverPath/php/$version/etc/php.ini |
||||
|
||||
rm -f $extFile |
||||
$serverPath/php/init.d/php$version reload |
||||
echo '===============================================' |
||||
echo 'successful!' |
||||
} |
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then |
||||
Install_lib |
||||
elif [ "$actionType" == 'uninstall' ];then |
||||
Uninstall_lib |
||||
fi |
Loading…
Reference in new issue