Prechádzať zdrojové kódy

Merge branch 'main' into nginx1.25.1fix

张小璋 3 mesiacov pred
rodič
commit
77ef07bd14
4 zmenil súbory, kde vykonal 161 pridanie a 23 odobranie
  1. 5 5
      include/check_sw.sh
  2. 149 12
      include/php-8.4.sh
  3. 2 2
      install.sh
  4. 5 4
      versions.txt

+ 5 - 5
include/check_sw.sh

@@ -11,7 +11,7 @@ installDepsDebian() {
   echo "${CMSG}Removing the conflicting packages...${CEND}"
   if [ "${apache_flag}" == 'y' ]; then
     killall apache2
-    pkgList="apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker php5 php5-common php5-cgi php5-cli php5-mysql php5-curl php5-gd"
+    pkgList="apache2 apache2-doc libsodium-dev apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker php5 php5-common php5-cgi php5-cli php5-mysql php5-curl php5-gd"
     for Package in ${pkgList};do
       apt-get -y purge ${Package}
     done
@@ -19,7 +19,7 @@ installDepsDebian() {
   fi
 
   if [[ "${db_option}" =~ ^[1-9]$|^1[0-2]$ ]]; then
-    pkgList="mysql-client mysql-server mysql-common mysql-server-core-5.5 mysql-client-5.5 mariadb-client mariadb-server mariadb-common"
+    pkgList="mysql-client mysql-server mysql-common libsodium-dev mysql-server-core-5.5 mysql-client-5.5 mariadb-client mariadb-server mariadb-common"
     for Package in ${pkgList};do
       apt-get -y purge ${Package}
     done
@@ -39,7 +39,7 @@ installDepsDebian() {
   # Install needed packages
   case "${Debian_ver}" in
     9|10|11|12)
-      pkgList="debian-keyring debian-archive-keyring build-essential gcc g++ make cmake autoconf libjpeg62-turbo-dev libjpeg-dev libpng-dev libgd-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libc-client2007e-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3-gnutls libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl net-tools libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales patch vim zip unzip tmux htop bc dc expect libexpat1-dev libonig-dev libtirpc-dev rsync git lsof lrzsz rsyslog cron logrotate chrony libsqlite3-dev psmisc wget sysv-rc apt-transport-https ca-certificates software-properties-common gnupg ufw"
+      pkgList="debian-keyring libsodium-dev debian-archive-keyring libxpm-dev build-essential gcc g++ make cmake autoconf libbz2-dev libjpeg62-turbo-dev libjpeg-dev libpng-dev libgd-dev libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libc-client2007e-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3-gnutls libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl net-tools libssl-dev libtool libevent-dev bison re2c libsasl2-dev libxslt1-dev libicu-dev locales patch vim zip unzip tmux htop bc dc expect libexpat1-dev libonig-dev libtirpc-dev rsync git lsof lrzsz rsyslog cron logrotate chrony libsqlite3-dev psmisc wget sysv-rc apt-transport-https ca-certificates software-properties-common gnupg ufw"
       ;;
     *)
       echo "${CFAILURE}Your system Debian ${Debian_ver} are not supported!${CEND}"
@@ -92,7 +92,7 @@ installDepsRHEL() {
 
   echo "${CMSG}Installing dependencies packages...${CEND}"
   # Install needed packages
-  pkgList="perl-FindBin deltarpm drpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-devel libjpeg-turbo libjpeg-turbo-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel libzip libzip-devel glibc glibc-devel krb5-devel libc-client libc-client-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel ncurses-compat-libs libaio numactl numactl-libs readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel net-tools libxslt-devel libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel libmcrypt libmcrypt-devel mhash mhash-devel mcrypt zip unzip chrony oniguruma-devel rpcgen sqlite-devel sysstat patch bc expect expat-devel perl-devel oniguruma oniguruma-devel libtirpc-devel nss libnsl rsync rsyslog git lsof lrzsz psmisc wget which libatomic tmux chkconfig firewalld"
+  pkgList="perl-FindBin deltarpm libsodium-dev drpm gcc gcc-c++ make cmake autoconf libjpeg libjpeg-dev libjpeg-devel libbz2-dev libjpeg-turbo libjpeg-turbo-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel libzip libzip-devel glibc glibc-devel krb5-devel libcurl4-openssl-dev libc-client libc-client-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel ncurses-compat-libs libaio numactl numactl-libs readline-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel net-tools libxslt-devel libssl-dev libicu-devel libevent-devel libtool libtool-ltdl bison gd-devel vim-enhanced pcre-devel libmcrypt libsqlite3-dev libmcrypt-devel mhash mhash-devel mcrypt zip unzip chrony oniguruma-devel rpcgen sqlite-devel sysstat patch bc expect expat-devel perl-devel oniguruma oniguruma-devel libtirpc-devel nss libnsl rsync rsyslog git lsof lrzsz psmisc wget which libatomic tmux chkconfig firewalld"
   for Package in ${pkgList}; do
     yum -y install ${Package}
   done
@@ -133,7 +133,7 @@ installDepsUbuntu() {
   apt-get -y upgrade -o Dir::Etc::SourceList=/tmp/security.sources.list
 
   # Install needed packages
-  pkgList="libperl-dev debian-keyring debian-archive-keyring build-essential gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng-dev libpng12-0 libpng12-dev libpng3 libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libc-client2007e-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3-gnutls libcurl4-gnutls-dev libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl net-tools libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev libsqlite3-dev libcloog-ppl1 bison patch vim zip unzip tmux htop bc dc expect libexpat1-dev rsyslog libonig-dev libtirpc-dev libnss3 rsync git lsof lrzsz chrony psmisc wget sysv-rc apt-transport-https ca-certificates software-properties-common gnupg ufw"
+  pkgList="libperl-dev pkg-config libsodium-dev libbz2-dev libxslt-dev libjpeg-dev libxml2-dev libxpm-dev libfreetype-dev debian-keyring debian-archive-keyring build-essential gcc g++ make cmake autoconf libjpeg8 libjpeg8-dev libpng-dev libpng12-0 libpng12-dev libpng3 libxml2 libxml2-dev zlib1g zlib1g-dev libc6 libc6-dev libc-client2007e-dev libglib2.0-0 libglib2.0-dev bzip2 libzip-dev libbz2-1.0 libncurses5 libncurses5-dev libaio1 libaio-dev numactl libreadline-dev curl libcurl3-gnutls libcurl4-gnutls-dev libcurl4-openssl-dev e2fsprogs libkrb5-3 libkrb5-dev libltdl-dev libidn11 libidn11-dev openssl net-tools libssl-dev libtool libevent-dev re2c libsasl2-dev libxslt1-dev libicu-dev libsqlite3-dev libcloog-ppl1 bison patch vim zip unzip tmux htop bc dc expect libexpat1-dev rsyslog libonig-dev libtirpc-dev libnss3 rsync git lsof lrzsz chrony psmisc wget sysv-rc apt-transport-https ca-certificates software-properties-common gnupg ufw libiconv-dev libfreetype6-dev libexif-dev gettext-dev libgmp-dev"
   export DEBIAN_FRONTEND=noninteractive
   for Package in ${pkgList}; do
     apt-get --no-install-recommends -y install ${Package}

+ 149 - 12
include/php-8.4.sh

@@ -1,6 +1,15 @@
 #!/bin/bash
 
 Install_PHP84() {
+  # Check CentOS version
+  if [ -f /etc/redhat-release ]; then
+    OS_VERSION=$(grep -oE '[0-9]+\.[0-9]+' /etc/redhat-release | cut -d'.' -f1)
+    if [ "${OS_VERSION}" -lt "8" ]; then
+      echo "${CFAILURE}Error: PHP 8.4 cannot be installed on CentOS ${OS_VERSION}. Minimum required version is CentOS 8.${CEND}"
+      kill -9 $$; exit 1;
+    fi
+  fi
+
   pushd ${oneinstack_dir}/src > /dev/null
   
   if [ ! -e "${php_install_dir}/bin/phpize" ]; then
@@ -10,9 +19,6 @@ Install_PHP84() {
     # 下载和校验
     src_url=https://www.php.net/distributions/php-${PHP_version}.tar.gz && Download_src
     
-    # 安装依赖
-    Install_PHP_Dependent
-    
     # 编译安装
     tar xzf php-${PHP_version}.tar.gz
     pushd php-${PHP_version} > /dev/null
@@ -25,7 +31,6 @@ Install_PHP84() {
     --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
     --with-fpm-user=${run_user} \
     --with-fpm-group=${run_user} \
-    --with-pear=/usr/share/php \
     --enable-mysqlnd \
     --with-mysqli=mysqlnd \
     --with-pdo-mysql=mysqlnd \
@@ -38,9 +43,7 @@ Install_PHP84() {
     --with-iconv \
     --with-gettext \
     --with-readline \
-    --with-mhash \
-    --with-ldap \
-    --with-ldap-sasl \
+    --with-ldapsasl \
     --with-sodium \
     --enable-bcmath \
     --enable-fpm \
@@ -66,19 +69,153 @@ Install_PHP84() {
     make -j ${THREAD} && make install
     
     if [ -e "${php_install_dir}/bin/phpize" ]; then
-      # 配置文件
+      # php.ini配置
       mkdir -p ${php_install_dir}/etc/php.d
       \cp php.ini-production ${php_install_dir}/etc/php.ini
+      tee -a ${php_install_dir}/etc/php.ini <<EOF
+
+; Modify php.ini Config by User
+memory_limit = 512M
+output_buffering = On
+short_open_tag = On
+expose_php = Off
+request_order = "CGP"
+date.timezone = ${timezone}
+post_max_size = 128M
+upload_max_filesize = 128M
+max_execution_time = 300
+realpath_cache_size = 2M
+disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,readlink,symlink,popepassthru,stream_socket_server,fsocket,popen
+max_file_uploads = 20
+max_input_time = 300
+EOF
+
+      if [ -e /usr/sbin/sendmail ]; then
+        tee -a ${php_install_dir}/etc/php.ini <<EOF
+sendmail_path = /usr/sbin/sendmail -t -i
+EOF
+      fi
       
-      # PHP-FPM配置
+      # php-fpm.conf配置
       \cp sapi/fpm/php-fpm.conf.in ${php_install_dir}/etc/php-fpm.conf
       \cp sapi/fpm/www.conf.in ${php_install_dir}/etc/php-fpm.d/www.conf
-      sed -i "s@^;pid = run/php-fpm.pid@pid = run/php-fpm.pid@" ${php_install_dir}/etc/php-fpm.conf
+      sed -i "s@^include=@;include=@" ${php_install_dir}/etc/php-fpm.conf
+      tee -a ${php_install_dir}/etc/php-fpm.conf <<EOF
+
+; Modify php-fpm.conf Config by User
+pid = run/php-fpm.pid
+error_log = log/php-fpm.log
+log_level = warning
+emergency_restart_threshold = 30
+emergency_restart_interval = 60s
+process_control_timeout = 5s
+daemonize = yes
+include=${php_install_dir}/etc/php-fpm.d/*.conf
+EOF
+
+      # php-fpm.d/www.conf配置
+      tee -a ${php_install_dir}/etc/php-fpm.d/www.conf <<EOF
+
+; Modify php-fpm.d/www.conf Config by User
+[${run_user}]
+listen = /dev/shm/php-cgi.sock
+listen.backlog = 65535
+listen.allowed_clients = 127.0.0.1
+listen.owner = ${run_user}
+listen.group = ${run_group}
+listen.mode = 0666
+
+user = ${run_user}
+group = ${run_group}
+
+pm = dynamic
+pm.max_children = 20
+pm.start_servers = 15
+pm.min_spare_servers = 10
+pm.max_spare_servers = 20
+pm.max_requests = 10240
+pm.process_idle_timeout = 10s
+pm.status_path = /php-fpm_status
+
+request_terminate_timeout = 300
+request_slowlog_timeout = 10s
+slowlog = var/log/slow.log
+rlimit_files = 65535
+rlimit_core = 0
+catch_workers_output = yes
+
+php_admin_value[error_log] = var/log/php-fpm.error.log
+php_admin_flag[log_errors] = on
+
+php_admin_value[opcache.enable] = 1
+php_admin_value[opcache.memory_consumption] = 128
+php_admin_value[opcache.interned_strings_buffer] = 16
+php_admin_value[opcache.max_accelerated_files] = 10000
+php_admin_value[opcache.validate_timestamps] = 1
+php_admin_value[opcache.revalidate_freq] = 60
+
+env[HOSTNAME] = $HOSTNAME
+env[PATH] = /usr/local/bin:/usr/bin:/bin
+env[TMP] = /tmp
+env[TMPDIR] = /tmp
+env[TEMP] = /tmp
+
+; Recommended, if you need to adjust, please modify the following parameters.
+EOF
+
+      # php-fpm内存优化
+      if [ $Mem -gt 8500 ]; then
+        tee -a ${php_install_dir}/etc/php-fpm.d/www.conf <<EOF
+pm.max_children = 80
+pm.start_servers = 60
+pm.min_spare_servers = 50
+pm.max_spare_servers = 80
+EOF
+      elif [ $Mem -gt 6500 ]; then
+        tee -a ${php_install_dir}/etc/php-fpm.d/www.conf <<EOF
+pm.max_children = 70
+pm.start_servers = 50
+pm.min_spare_servers = 40
+pm.max_spare_servers = 70
+EOF
+      elif [ $Mem -gt 4500 ]; then
+        tee -a ${php_install_dir}/etc/php-fpm.d/www.conf <<EOF
+pm.max_children = 60
+pm.start_servers = 40
+pm.min_spare_servers = 30
+pm.max_spare_servers = 60
+EOF
+      elif [ $Mem -gt 3000 ]; then
+        tee -a ${php_install_dir}/etc/php-fpm.d/www.conf <<EOF
+pm.max_children = 50
+pm.start_servers = 30
+pm.min_spare_servers = 20
+pm.max_spare_servers = 50
+EOF
+      else
+        tee -a ${php_install_dir}/etc/php-fpm.d/www.conf <<EOF
+pm.max_children = $(($Mem/3/20))
+pm.start_servers = $(($Mem/3/30))
+pm.min_spare_servers = $(($Mem/3/40))
+pm.max_spare_servers = $(($Mem/3/20))
+EOF
+      fi
       
       # 启动脚本
       \cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
       sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
-      systemctl enable php-fpm
+      systemctl enable --now php-fpm.service
+
+      # 检测php-fpm是否启动成功,没有成功则重启php-fpm再试一次,如果还不成功则退出
+      systemctl status php-fpm.service | grep "Active: active (running)"
+      if [ $? -ne 0 ]; then
+        systemctl restart php-fpm.service
+        systemctl status php-fpm.service | grep "Active: active (running)"
+        if [ $? -ne 0 ]; then
+          echo "${CFAILURE}PHP ${PHP_version} install failed, Please Contact the author! ${CEND}"
+          kill -9 $$; exit 1;
+        fi
+      fi
 
       # 环境变量
       echo "export PATH=${php_install_dir}/bin:\$PATH" > /etc/profile.d/php.sh
@@ -93,4 +230,4 @@ Install_PHP84() {
     popd > /dev/null
   fi
   popd > /dev/null
-}
+}

+ 2 - 2
install.sh

@@ -651,8 +651,8 @@ if [ ${ARG_NUM} == 0 ]; then
           echo -e "\t${CMSG}14${CEND}. Install php-8.4"
           read -e -p "Please input a number:(Default 7 press Enter) " php_option
           php_option=${php_option:-7}
-          if [[ ! ${php_option} =~ ^[1-9]$|^1[0-3]$ ]]; then
-            echo "${CWARNING}input error! Please only input number 1~13${CEND}"
+          if [[ ! ${php_option} =~ ^[1-9]$|^1[0-4]$ ]]; then
+            echo "${CWARNING}input error! Please only input number 1~14${CEND}"
           else
             break
           fi

+ 5 - 4
versions.txt

@@ -53,6 +53,7 @@ php80_ver=8.0.30
 php81_ver=8.1.27
 php82_ver=8.2.14
 php83_ver=8.3.2
+php84_ver=8.4.4
 
 # Nodejs
 nodejs_ver=20.10.0
@@ -68,7 +69,7 @@ libsodium_ver=1.0.18
 libsodium_up_ver=1.0.19
 libzip_ver=1.2.0
 argon2_ver=20171227
-imagemagick_ver=7.1.1-23
+imagemagick_ver=7.1.1-45
 imagick_ver=3.7.0
 imagick_oldver=3.4.4
 graphicsmagick_ver=1.3.40
@@ -83,7 +84,7 @@ phalcon_ver=5.4.0
 phalcon_oldver=3.4.5
 yaf_ver=3.3.2
 yar_ver=2.2.0
-swoole_ver=5.0.3
+swoole_ver=6.0.1
 swoole_oldver=4.8.12
 xdebug_ver=3.1.2
 xdebug_oldver=2.9.8
@@ -94,7 +95,7 @@ pureftpd_ver=1.0.51
 # Redis
 redis_ver=7.2.3
 redis_oldver=6.2.14
-pecl_redis_ver=6.0.2
+pecl_redis_ver=6.1.0
 
 # Memcached
 memcached_ver=1.6.22
@@ -105,7 +106,7 @@ pecl_memcache_ver=8.2
 pecl_memcache_oldver=4.0.5.2
 
 # MongoDB
-pecl_mongodb_ver=1.16.2
+pecl_mongodb_ver=1.21.0
 pecl_mongodb_oldver=1.9.2
 pecl_mongo_ver=1.6.16