From 7fbe421b0cd4f37e8b3ac4d4e2da810484f5c2f7 Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 6 Oct 2022 14:16:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=BF=ABphp=E7=BC=96=E8=AF=91?= =?UTF-8?q?=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/php/versions/53/install.sh | 20 +++++++++++++++++++- plugins/php/versions/54/install.sh | 21 ++++++++++++++++++++- plugins/php/versions/55/install.sh | 21 ++++++++++++++++++++- plugins/php/versions/56/install.sh | 21 ++++++++++++++++++++- plugins/php/versions/71/install.sh | 21 ++++++++++++++++++++- plugins/php/versions/72/install.sh | 21 ++++++++++++++++++++- plugins/php/versions/73/install.sh | 21 ++++++++++++++++++++- plugins/php/versions/74/install.sh | 20 +++++++++++++++++++- 8 files changed, 158 insertions(+), 8 deletions(-) diff --git a/plugins/php/versions/53/install.sh b/plugins/php/versions/53/install.sh index 959104224..9ce860b4a 100755 --- a/plugins/php/versions/53/install.sh +++ b/plugins/php/versions/53/install.sh @@ -56,6 +56,24 @@ if [ "$IS_64BIT" == "64" ];then OPTIONS="${OPTIONS} --with-libdir=lib64" fi +# ----- cpu start ------ +if [ -z "${cpuCore}" ]; then + cpuCore="1" +fi + +if [ -f /proc/cpuinfo ];then + cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l` +fi + +MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}') +if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then + if [ "${cpuCore}" -gt "${MEM_INFO}" ];then + cpuCore="${MEM_INFO}" + fi +else + cpuCore="1" +fi +# ----- cpu end ------ if [ ! -d $serverPath/php/53/bin ];then cd $sourcePath/php/php${PHP_VER} && ./configure \ @@ -88,7 +106,7 @@ if [ ! -d $serverPath/php/53/bin ];then --disable-fileinfo \ $OPTIONS \ --enable-fpm - make clean && make && make install && make clean + make clean && make -j${cpuCore} && make install && make clean fi diff --git a/plugins/php/versions/54/install.sh b/plugins/php/versions/54/install.sh index 9d042dd0f..e144738eb 100755 --- a/plugins/php/versions/54/install.sh +++ b/plugins/php/versions/54/install.sh @@ -48,6 +48,25 @@ if [ "$IS_64BIT" == "64" ];then OPTIONS="${OPTIONS} --with-libdir=lib64" fi +# ----- cpu start ------ +if [ -z "${cpuCore}" ]; then + cpuCore="1" +fi + +if [ -f /proc/cpuinfo ];then + cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l` +fi + +MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}') +if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then + if [ "${cpuCore}" -gt "${MEM_INFO}" ];then + cpuCore="${MEM_INFO}" + fi +else + cpuCore="1" +fi +# ----- cpu end ------ + if [ ! -d $serverPath/php/${PHP_VER} ];then cd $sourcePath/php/php${PHP_VER} && ./configure \ @@ -73,7 +92,7 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then $OPTIONS \ --enable-fpm - make clean && make + make clean && make -j${cpuCore} #debian11,没有生成php54 man if [ ! -f sapi/cli/php.1 ];then diff --git a/plugins/php/versions/55/install.sh b/plugins/php/versions/55/install.sh index a801717b9..e7adad4f9 100755 --- a/plugins/php/versions/55/install.sh +++ b/plugins/php/versions/55/install.sh @@ -47,6 +47,25 @@ if [ "$IS_64BIT" == "64" ];then OPTIONS="${OPTIONS} --with-libdir=lib64" fi +# ----- cpu start ------ +if [ -z "${cpuCore}" ]; then + cpuCore="1" +fi + +if [ -f /proc/cpuinfo ];then + cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l` +fi + +MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}') +if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then + if [ "${cpuCore}" -gt "${MEM_INFO}" ];then + cpuCore="${MEM_INFO}" + fi +else + cpuCore="1" +fi +# ----- cpu end ------ + if [ ! -d $serverPath/php/55 ];then cd $sourcePath/php/php${PHP_VER} && ./configure \ --prefix=$serverPath/php/55 \ @@ -71,7 +90,7 @@ if [ ! -d $serverPath/php/55 ];then --disable-fileinfo \ $OPTIONS \ --enable-fpm - make clean && make && make install && make clean + make clean && make -j${cpuCore} && make install && make clean fi #------------------------ install end ------------------------------------# diff --git a/plugins/php/versions/56/install.sh b/plugins/php/versions/56/install.sh index 3d185c01b..a5b4d97f4 100755 --- a/plugins/php/versions/56/install.sh +++ b/plugins/php/versions/56/install.sh @@ -47,6 +47,25 @@ if [ "$IS_64BIT" == "64" ];then OPTIONS="${OPTIONS} --with-libdir=lib64" fi +# ----- cpu start ------ +if [ -z "${cpuCore}" ]; then + cpuCore="1" +fi + +if [ -f /proc/cpuinfo ];then + cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l` +fi + +MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}') +if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then + if [ "${cpuCore}" -gt "${MEM_INFO}" ];then + cpuCore="${MEM_INFO}" + fi +else + cpuCore="1" +fi +# ----- cpu end ------ + if [ ! -d $serverPath/php/56 ];then cd $sourcePath/php/php${PHP_VER} && ./configure \ @@ -74,7 +93,7 @@ if [ ! -d $serverPath/php/56 ];then --disable-fileinfo \ $OPTIONS \ --enable-fpm - make clean && make && make install && make clean + make clean && make -j${cpuCore} && make install && make clean fi #------------------------ install end ------------------------------------# diff --git a/plugins/php/versions/71/install.sh b/plugins/php/versions/71/install.sh index 9c4c0ac4b..1e8d5efd7 100755 --- a/plugins/php/versions/71/install.sh +++ b/plugins/php/versions/71/install.sh @@ -44,6 +44,25 @@ if [ "$IS_64BIT" == "64" ];then OPTIONS="${OPTIONS} --with-libdir=lib64" fi +# ----- cpu start ------ +if [ -z "${cpuCore}" ]; then + cpuCore="1" +fi + +if [ -f /proc/cpuinfo ];then + cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l` +fi + +MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}') +if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then + if [ "${cpuCore}" -gt "${MEM_INFO}" ];then + cpuCore="${MEM_INFO}" + fi +else + cpuCore="1" +fi +# ----- cpu end ------ + if [ ! -d $serverPath/php/71 ];then cd $sourcePath/php/php${PHP_VER} && ./configure \ --prefix=$serverPath/php/71 \ @@ -67,7 +86,7 @@ if [ ! -d $serverPath/php/71 ];then --disable-fileinfo \ $OPTIONS \ --enable-fpm - make clean && make && make install && make clean + make clean && make -j${cpuCore} && make install && make clean fi #------------------------ install end ------------------------------------# diff --git a/plugins/php/versions/72/install.sh b/plugins/php/versions/72/install.sh index 4f814f83b..c75d9c93f 100755 --- a/plugins/php/versions/72/install.sh +++ b/plugins/php/versions/72/install.sh @@ -46,6 +46,25 @@ if [ "$IS_64BIT" == "64" ];then OPTIONS="${OPTIONS} --with-libdir=lib64" fi +# ----- cpu start ------ +if [ -z "${cpuCore}" ]; then + cpuCore="1" +fi + +if [ -f /proc/cpuinfo ];then + cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l` +fi + +MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}') +if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then + if [ "${cpuCore}" -gt "${MEM_INFO}" ];then + cpuCore="${MEM_INFO}" + fi +else + cpuCore="1" +fi +# ----- cpu end ------ + if [ ! -d $serverPath/php/72 ];then cd $sourcePath/php/php${PHP_VER} && ./configure \ --prefix=$serverPath/php/72 \ @@ -69,7 +88,7 @@ if [ ! -d $serverPath/php/72 ];then --disable-fileinfo \ $OPTIONS \ --enable-fpm - make clean && make && make install && make clean + make clean && make -j${cpuCore} && make install && make clean fi #------------------------ install end ------------------------------------# diff --git a/plugins/php/versions/73/install.sh b/plugins/php/versions/73/install.sh index cb05afe83..de25f7bb0 100755 --- a/plugins/php/versions/73/install.sh +++ b/plugins/php/versions/73/install.sh @@ -60,6 +60,25 @@ if version_lt "$libzip_version" "0.11.0" ;then ZIP_OPTION="--with-libzip=$serverPath/lib/libzip" fi +# ----- cpu start ------ +if [ -z "${cpuCore}" ]; then + cpuCore="1" +fi + +if [ -f /proc/cpuinfo ];then + cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l` +fi + +MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}') +if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then + if [ "${cpuCore}" -gt "${MEM_INFO}" ];then + cpuCore="${MEM_INFO}" + fi +else + cpuCore="1" +fi +# ----- cpu end ------ + if [ ! -d $serverPath/php/73 ];then cd $sourcePath/php/php${PHP_VER} && ./configure \ --prefix=$serverPath/php/73 \ @@ -83,7 +102,7 @@ if [ ! -d $serverPath/php/73 ];then --disable-fileinfo \ $OPTIONS \ --enable-fpm - make clean && make && make install && make clean + make clean && make -j${cpuCore} && make install && make clean fi #------------------------ install end ------------------------------------# diff --git a/plugins/php/versions/74/install.sh b/plugins/php/versions/74/install.sh index a09ffe377..d6e661fec 100755 --- a/plugins/php/versions/74/install.sh +++ b/plugins/php/versions/74/install.sh @@ -76,6 +76,24 @@ if version_lt "$libzip_version" "0.11.0" ;then ZIP_OPTION="--with-zip=$serverPath/lib/libzip" fi +# ----- cpu start ------ +if [ -z "${cpuCore}" ]; then + cpuCore="1" +fi + +if [ -f /proc/cpuinfo ];then + cpuCore=`cat /proc/cpuinfo | grep "processor" | wc -l` +fi + +MEM_INFO=$(free -m|grep Mem|awk '{printf("%.f",($2)/1024)}') +if [ "${cpuCore}" != "1" ] && [ "${MEM_INFO}" != "0" ];then + if [ "${cpuCore}" -gt "${MEM_INFO}" ];then + cpuCore="${MEM_INFO}" + fi +else + cpuCore="1" +fi +# ----- cpu end ------ if [ ! -d $serverPath/php/${PHP_VER} ];then cd $sourcePath/php/php${PHP_VER} && make clean @@ -102,7 +120,7 @@ if [ ! -d $serverPath/php/${PHP_VER} ];then --disable-fileinfo \ $OPTIONS \ --enable-fpm - make && make install && make clean + make clean && make -j${cpuCore} && make install && make clean fi #------------------------ install end ------------------------------------# }