From 5f416ba2d4dbd5d3445d33f14e5da5129e2c93e5 Mon Sep 17 00:00:00 2001 From: midoks Date: Mon, 13 Jul 2020 00:01:08 +0800 Subject: [PATCH] xhprof update --- plugins/php/versions/53/xhprof.sh | 4 ++ plugins/php/versions/54/xhprof.sh | 3 + plugins/php/versions/55/xhprof.sh | 3 + plugins/php/versions/56/xhprof.sh | 2 + plugins/php/versions/70/xhprof.sh | 97 +++++++++++++++++++++++++++++++ plugins/php/versions/71/xhprof.sh | 2 + plugins/php/versions/72/xhprof.sh | 97 +++++++++++++++++++++++++++++++ plugins/php/versions/73/xhprof.sh | 97 +++++++++++++++++++++++++++++++ plugins/php/versions/74/xhprof.sh | 97 +++++++++++++++++++++++++++++++ 9 files changed, 402 insertions(+) create mode 100755 plugins/php/versions/70/xhprof.sh create mode 100755 plugins/php/versions/72/xhprof.sh create mode 100755 plugins/php/versions/73/xhprof.sh create mode 100755 plugins/php/versions/74/xhprof.sh diff --git a/plugins/php/versions/53/xhprof.sh b/plugins/php/versions/53/xhprof.sh index e4d724593..fe249a3c7 100755 --- a/plugins/php/versions/53/xhprof.sh +++ b/plugins/php/versions/53/xhprof.sh @@ -57,6 +57,8 @@ Install_lib() echo "" >> $serverPath/php/$version/etc/php.ini echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + echo "${LIBNAME}.output_dir=/tmp/xhprof" >> $serverPath/php/$version/etc/php.ini + $serverPath/php/init.d/php$version reload echo '===========================================================' @@ -81,6 +83,8 @@ Uninstall_lib() sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini rm -f $extFile + rm -rf /tmp/xhprof + $serverPath/php/init.d/php$version reload echo '===============================================' echo 'successful!' diff --git a/plugins/php/versions/54/xhprof.sh b/plugins/php/versions/54/xhprof.sh index cdf21a16c..be410f0fc 100755 --- a/plugins/php/versions/54/xhprof.sh +++ b/plugins/php/versions/54/xhprof.sh @@ -55,6 +55,7 @@ Install_lib() echo "" >> $serverPath/php/$version/etc/php.ini echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + echo "${LIBNAME}.output_dir=/tmp/xhprof" >> $serverPath/php/$version/etc/php.ini $serverPath/php/init.d/php$version reload echo '===========================================================' @@ -79,6 +80,8 @@ Uninstall_lib() sed -i '_bak' "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini rm -f $extFile + rm -rf /tmp/xhprof + $serverPath/php/init.d/php$version reload echo '===============================================' echo 'successful!' diff --git a/plugins/php/versions/55/xhprof.sh b/plugins/php/versions/55/xhprof.sh index e46bc9db7..b45080958 100755 --- a/plugins/php/versions/55/xhprof.sh +++ b/plugins/php/versions/55/xhprof.sh @@ -58,6 +58,7 @@ Install_lib() echo "" >> $serverPath/php/$version/etc/php.ini echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + echo "${LIBNAME}.output_dir=/tmp/xhprof" >> $serverPath/php/$version/etc/php.ini $serverPath/php/init.d/php$version reload echo '===========================================================' @@ -82,6 +83,8 @@ Uninstall_lib() sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini rm -f $extFile + rm -rf /tmp/xhprof + $serverPath/php/init.d/php$version reload echo '===============================================' echo 'successful!' diff --git a/plugins/php/versions/56/xhprof.sh b/plugins/php/versions/56/xhprof.sh index bedcfc113..1d45665a6 100755 --- a/plugins/php/versions/56/xhprof.sh +++ b/plugins/php/versions/56/xhprof.sh @@ -58,6 +58,7 @@ Install_lib() echo "" >> $serverPath/php/$version/etc/php.ini echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + echo "${LIBNAME}.output_dir=/tmp/xhprof" >> $serverPath/php/$version/etc/php.ini $serverPath/php/init.d/php$version reload echo '===========================================================' @@ -82,6 +83,7 @@ Uninstall_lib() sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini rm -f $extFile + rm -rf /tmp/xhprof $serverPath/php/init.d/php$version reload echo '===============================================' echo 'successful!' diff --git a/plugins/php/versions/70/xhprof.sh b/plugins/php/versions/70/xhprof.sh new file mode 100755 index 000000000..47a808031 --- /dev/null +++ b/plugins/php/versions/70/xhprof.sh @@ -0,0 +1,97 @@ +#!/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=xhprof +LIBV=2.2.0 +sysName=`uname` +actionType=$1 +version=$2 +extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20151012/${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 [ ! -d $php_lib/${LIBNAME}-${LIBV} ];then + wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz + cd $php_lib && tar xvf ${LIBNAME}-${LIBV}.tgz + fi + cd $php_lib/${LIBNAME}-${LIBV}/extension + + $serverPath/php/$version/bin/phpize + ./configure --enable-xhprof \ + --with-php-config=$serverPath/php/$version/bin/php-config + make && make install && make clean + + fi + + if [ ! -f "$extFile" ];then + echo "ERROR!" + return + fi + + + echo "" >> $serverPath/php/$version/etc/php.ini + echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini + echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + echo "${LIBNAME}.output_dir=/tmp/xhprof" >> $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},请选择其它版本!" + echo "php-$version not install ${LIBNAME}, Plese select other version!" + return + fi + + sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini + + rm -f $extFile + rm -rf /tmp/xhprof + $serverPath/php/init.d/php$version reload + echo '===============================================' + echo 'successful!' +} + + +if [ "$actionType" == 'install' ];then + Install_lib +elif [ "$actionType" == 'uninstall' ];then + Uninstall_lib +fi \ No newline at end of file diff --git a/plugins/php/versions/71/xhprof.sh b/plugins/php/versions/71/xhprof.sh index 2e52e2971..4464ff396 100755 --- a/plugins/php/versions/71/xhprof.sh +++ b/plugins/php/versions/71/xhprof.sh @@ -58,6 +58,7 @@ Install_lib() echo "" >> $serverPath/php/$version/etc/php.ini echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + echo "${LIBNAME}.output_dir=/tmp/xhprof" >> $serverPath/php/$version/etc/php.ini $serverPath/php/init.d/php$version reload echo '===========================================================' @@ -82,6 +83,7 @@ Uninstall_lib() sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini rm -f $extFile + rm -rf /tmp/xhprof $serverPath/php/init.d/php$version reload echo '===============================================' echo 'successful!' diff --git a/plugins/php/versions/72/xhprof.sh b/plugins/php/versions/72/xhprof.sh new file mode 100755 index 000000000..995a11969 --- /dev/null +++ b/plugins/php/versions/72/xhprof.sh @@ -0,0 +1,97 @@ +#!/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=xhprof +LIBV=2.2.0 +sysName=`uname` +actionType=$1 +version=$2 +extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20170718/${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 [ ! -d $php_lib/${LIBNAME}-${LIBV} ];then + wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz + cd $php_lib && tar xvf ${LIBNAME}-${LIBV}.tgz + fi + cd $php_lib/${LIBNAME}-${LIBV}/extension + + $serverPath/php/$version/bin/phpize + ./configure --enable-xhprof \ + --with-php-config=$serverPath/php/$version/bin/php-config + make && make install && make clean + + fi + + if [ ! -f "$extFile" ];then + echo "ERROR!" + return + fi + + + echo "" >> $serverPath/php/$version/etc/php.ini + echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini + echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + echo "${LIBNAME}.output_dir=/tmp/xhprof" >> $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},请选择其它版本!" + echo "php-$version not install ${LIBNAME}, Plese select other version!" + return + fi + + sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini + + rm -f $extFile + rm -rf /tmp/xhprof + $serverPath/php/init.d/php$version reload + echo '===============================================' + echo 'successful!' +} + + +if [ "$actionType" == 'install' ];then + Install_lib +elif [ "$actionType" == 'uninstall' ];then + Uninstall_lib +fi \ No newline at end of file diff --git a/plugins/php/versions/73/xhprof.sh b/plugins/php/versions/73/xhprof.sh new file mode 100755 index 000000000..8b75bb673 --- /dev/null +++ b/plugins/php/versions/73/xhprof.sh @@ -0,0 +1,97 @@ +#!/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=xhprof +LIBV=2.2.0 +sysName=`uname` +actionType=$1 +version=$2 +extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20180731/${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 [ ! -d $php_lib/${LIBNAME}-${LIBV} ];then + wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz + cd $php_lib && tar xvf ${LIBNAME}-${LIBV}.tgz + fi + cd $php_lib/${LIBNAME}-${LIBV}/extension + + $serverPath/php/$version/bin/phpize + ./configure --enable-xhprof \ + --with-php-config=$serverPath/php/$version/bin/php-config + make && make install && make clean + + fi + + if [ ! -f "$extFile" ];then + echo "ERROR!" + return + fi + + + echo "" >> $serverPath/php/$version/etc/php.ini + echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini + echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + echo "${LIBNAME}.output_dir=/tmp/xhprof" >> $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},请选择其它版本!" + echo "php-$version not install ${LIBNAME}, Plese select other version!" + return + fi + + sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini + + rm -f $extFile + rm -rf /tmp/xhprof + $serverPath/php/init.d/php$version reload + echo '===============================================' + echo 'successful!' +} + + +if [ "$actionType" == 'install' ];then + Install_lib +elif [ "$actionType" == 'uninstall' ];then + Uninstall_lib +fi \ No newline at end of file diff --git a/plugins/php/versions/74/xhprof.sh b/plugins/php/versions/74/xhprof.sh new file mode 100755 index 000000000..c1cb4a60b --- /dev/null +++ b/plugins/php/versions/74/xhprof.sh @@ -0,0 +1,97 @@ +#!/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=xhprof +LIBV=2.2.0 +sysName=`uname` +actionType=$1 +version=$2 +extFile=$serverPath/php/${version}/lib/php/extensions/no-debug-non-zts-20190902/${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 [ ! -d $php_lib/${LIBNAME}-${LIBV} ];then + wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz + cd $php_lib && tar xvf ${LIBNAME}-${LIBV}.tgz + fi + cd $php_lib/${LIBNAME}-${LIBV}/extension + + $serverPath/php/$version/bin/phpize + ./configure --enable-xhprof \ + --with-php-config=$serverPath/php/$version/bin/php-config + make && make install && make clean + + fi + + if [ ! -f "$extFile" ];then + echo "ERROR!" + return + fi + + + echo "" >> $serverPath/php/$version/etc/php.ini + echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini + echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini + echo "${LIBNAME}.output_dir=/tmp/xhprof" >> $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},请选择其它版本!" + echo "php-$version not install ${LIBNAME}, Plese select other version!" + return + fi + + sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini + sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini + + rm -f $extFile + rm -rf /tmp/xhprof + $serverPath/php/init.d/php$version reload + echo '===============================================' + echo 'successful!' +} + + +if [ "$actionType" == 'install' ];then + Install_lib +elif [ "$actionType" == 'uninstall' ];then + Uninstall_lib +fi \ No newline at end of file