php-8.4.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #!/bin/bash
  2. Install_PHP84() {
  3. pushd ${oneinstack_dir}/src > /dev/null
  4. if [ ! -e "${php_install_dir}/bin/phpize" ]; then
  5. PHP_version=8.4.4
  6. PHP_main_ver=84
  7. # 下载和校验
  8. src_url=https://www.php.net/distributions/php-${PHP_version}.tar.gz && Download_src
  9. # 安装依赖
  10. Install_PHP_Dependent
  11. # 编译安装
  12. tar xzf php-${PHP_version}.tar.gz
  13. pushd php-${PHP_version} > /dev/null
  14. make clean
  15. [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir}
  16. # PHP 8.4 特定的编译选项
  17. ./configure --prefix=${php_install_dir} \
  18. --with-config-file-path=${php_install_dir}/etc \
  19. --with-config-file-scan-dir=${php_install_dir}/etc/php.d \
  20. --with-fpm-user=${run_user} \
  21. --with-fpm-group=${run_user} \
  22. --with-pear=/usr/share/php \
  23. --enable-mysqlnd \
  24. --with-mysqli=mysqlnd \
  25. --with-pdo-mysql=mysqlnd \
  26. --with-sqlite3 \
  27. --with-pdo-sqlite \
  28. --with-openssl \
  29. --with-zlib \
  30. --with-zip \
  31. --with-curl \
  32. --with-iconv \
  33. --with-gettext \
  34. --with-readline \
  35. --with-mhash \
  36. --with-ldap \
  37. --with-ldap-sasl \
  38. --with-sodium \
  39. --enable-bcmath \
  40. --enable-fpm \
  41. --enable-xml \
  42. --enable-sysvsem \
  43. --enable-sysvshm \
  44. --enable-sysvmsg \
  45. --enable-shmop \
  46. --enable-sockets \
  47. --enable-mbstring \
  48. --enable-pcntl \
  49. --enable-soap \
  50. --enable-gd \
  51. --enable-intl \
  52. --enable-opcache \
  53. --enable-ftp \
  54. --enable-exif \
  55. --enable-calendar \
  56. --without-pear \
  57. --disable-phar \
  58. --disable-rpath
  59. make -j ${THREAD} && make install
  60. if [ -e "${php_install_dir}/bin/phpize" ]; then
  61. # 配置文件
  62. mkdir -p ${php_install_dir}/etc/php.d
  63. \cp php.ini-production ${php_install_dir}/etc/php.ini
  64. # PHP-FPM配置
  65. \cp sapi/fpm/php-fpm.conf.in ${php_install_dir}/etc/php-fpm.conf
  66. \cp sapi/fpm/www.conf.in ${php_install_dir}/etc/php-fpm.d/www.conf
  67. sed -i "s@^;pid = run/php-fpm.pid@pid = run/php-fpm.pid@" ${php_install_dir}/etc/php-fpm.conf
  68. # 启动脚本
  69. \cp ${oneinstack_dir}/init.d/php-fpm.service /lib/systemd/system/
  70. sed -i "s@/usr/local/php@${php_install_dir}@g" /lib/systemd/system/php-fpm.service
  71. systemctl enable php-fpm
  72. # 环境变量
  73. echo "export PATH=${php_install_dir}/bin:\$PATH" > /etc/profile.d/php.sh
  74. echo "${CSUCCESS}PHP ${PHP_version} installed successfully! ${CEND}"
  75. rm -rf php-${PHP_version}
  76. else
  77. rm -rf ${php_install_dir}
  78. echo "${CFAILURE}PHP ${PHP_version} install failed, Please Contact the author! ${CEND}"
  79. kill -9 $$; exit 1;
  80. fi
  81. popd > /dev/null
  82. fi
  83. popd > /dev/null
  84. }