#!/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 PHP_version=8.4.4 PHP_main_ver=84 # 下载和校验 src_url=https://www.php.net/distributions/php-${PHP_version}.tar.gz && Download_src # 编译安装 tar xzf php-${PHP_version}.tar.gz pushd php-${PHP_version} > /dev/null make clean [ ! -d "${php_install_dir}" ] && mkdir -p ${php_install_dir} # PHP 8.4 特定的编译选项 ./configure --prefix=${php_install_dir} \ --with-config-file-path=${php_install_dir}/etc \ --with-config-file-scan-dir=${php_install_dir}/etc/php.d \ --with-fpm-user=${run_user} \ --with-fpm-group=${run_user} \ --enable-mysqlnd \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-sqlite3 \ --with-pdo-sqlite \ --with-openssl \ --with-zlib \ --with-zip \ --with-curl \ --with-iconv \ --with-gettext \ --with-readline \ --with-ldapsasl \ --with-sodium \ --enable-bcmath \ --enable-fpm \ --enable-xml \ --enable-sysvsem \ --enable-sysvshm \ --enable-sysvmsg \ --enable-shmop \ --enable-sockets \ --enable-mbstring \ --enable-pcntl \ --enable-soap \ --enable-gd \ --enable-intl \ --enable-opcache \ --enable-ftp \ --enable-exif \ --enable-calendar \ --without-pear \ --disable-phar \ --disable-rpath make -j ${THREAD} && make install if [ -e "${php_install_dir}/bin/phpize" ]; then # 配置文件 mkdir -p ${php_install_dir}/etc/php.d \cp php.ini-production ${php_install_dir}/etc/php.ini # 设置php.ini配置 tee -a ${php_install_dir}/etc/php.ini < /etc/profile.d/php.sh echo "${CSUCCESS}PHP ${PHP_version} installed successfully! ${CEND}" rm -rf php-${PHP_version} else rm -rf ${php_install_dir} echo "${CFAILURE}PHP ${PHP_version} install failed, Please Contact the author! ${CEND}" kill -9 $$; exit 1; fi popd > /dev/null fi popd > /dev/null }