fix: RHEL系PHP模组安装与环境配置

This commit is contained in:
Akatsukiro 2024-01-18 17:47:47 +08:00
parent 521ec6ea0b
commit 061e09a7d6
Signed by: Akatsukiro
GPG Key ID: 93F1D32999999999

View File

@ -101,20 +101,29 @@ install_php() {
if [[ $systemFlag == "1" ]]; then
wget -O /usr/share/keyrings/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb [signed-by=/usr/share/keyrings/php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
apt update && apt install php8.1 php8.1-{cli,fpm,mbstring,mysql,bcmath,xml,xmlrpc,imagick,curl,gmp,imap,opcache,mailparse,soap,gd,zip} -y
elif [[ $systemFlag == "2" ]]; then
add-apt-repository ppa:ondrej/php
apt update && apt install php8.1 php8.1-{cli,fpm,mbstring,mysql,bcmath,xml,xmlrpc,imagick,curl,gmp,imap,opcache,mailparse,soap,gd,zip} -y
elif [[ $systemFlag == "3" ]]; then
dnf install https://rpms.remirepo.net/enterprise/remi-release-${os_version}.rpm -y
dnf module reset php -y
dnf module install php:remi-8.1 -y
fi
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php/8.1/fpm/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 10M/' /etc/php/8.1/fpm/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 10M/' /etc/php/8.1/fpm/php.ini
# 关闭open_basedir
sed -i 's/;open_basedir =/open_basedir =/g' /etc/php/8.1/fpm/php.ini
if [[ $systemFlag == "1" ]] || [[ $systemFlag == "2" ]]; then
apt update && apt install php8.1 php8.1-{cli,fpm,mbstring,mysql,bcmath,xml,xmlrpc,imagick,curl,gmp,imap,opcache,mailparse,soap,gd,zip} -y
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php/8.1/fpm/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 10M/' /etc/php/8.1/fpm/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 10M/' /etc/php/8.1/fpm/php.ini
# 关闭open_basedir
sed -i 's/;open_basedir =/open_basedir =/g' /etc/php/8.1/fpm/php.ini
elif [[ $systemFlag == "3" ]]; then
dnf install php php-{cli,fpm,mbstring,mysqlnd,bcmath,xml,xmlrpc,imagick,curl,gmp,imap,opcache,mailparse,soap,gd,zip} -y
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 10M/' /etc/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 10M/' /etc/php.ini
# 关闭open_basedir
sed -i 's/;open_basedir =/open_basedir =/g' /etc/php.ini
fi
}
install_apache() {