From 81c792924041cae061b9ccc76af2e840828cd25d Mon Sep 17 00:00:00 2001 From: midoks Date: Thu, 6 Oct 2022 14:09:46 +0800 Subject: [PATCH] Update install.sh --- plugins/php/versions/80/install.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/plugins/php/versions/80/install.sh b/plugins/php/versions/80/install.sh index a04372e39..62a64a23c 100755 --- a/plugins/php/versions/80/install.sh +++ b/plugins/php/versions/80/install.sh @@ -67,6 +67,25 @@ 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 ------ + echo "$sourcePath/php/php${PHP_VER}" if [ ! -d $serverPath/php/${PHP_VER} ];then @@ -94,7 +113,7 @@ if [ ! -d $serverPath/php/${PHP_VER} ];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 ------------------------------------# }