From dff0c3b713ac28e701599d1f8438680ee7ccf84a Mon Sep 17 00:00:00 2001 From: Brock Humblet <61528382+BrockHumblet@users.noreply.github.com> Date: Mon, 31 Mar 2025 11:19:36 -0500 Subject: [PATCH] Update PHP to 8.3 (#3510) --- ct/2fauth.sh | 20 ++++++++++++++++++++ install/2fauth-install.sh | 13 +++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ct/2fauth.sh b/ct/2fauth.sh index bb68cb3cb..0f689bee2 100644 --- a/ct/2fauth.sh +++ b/ct/2fauth.sh @@ -41,8 +41,23 @@ function update_script() { # Creating Backup msg_info "Creating Backup" mv "/opt/2fauth" "/opt/2fauth-backup" + if ! dpkg -l | grep -q 'php8.3'; then + cp /etc/nginx/conf.d/2fauth.conf /etc/nginx/conf.d/2fauth.conf.bak + fi msg_ok "Backup Created" + # Upgrade PHP + if ! dpkg -l | grep -q 'php8.3'; then + $STD apt-get install -y \ + lsb-release \ + gpg + curl -fsSL https://packages.sury.org/php/apt.gpg | gpg --dearmor -o /usr/share/keyrings/deb.sury.org-php.gpg + echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list + $STD apt-get update + $STD apt-get install -y php8.3-{bcmath,common,ctype,curl,fileinfo,fpm,gd,mbstring,mysql,xml,cli,intl} + sed -i 's/php8.2/php8.3/g' /etc/nginx/conf.d/2fauth.conf + fi + # Execute Update wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip" unzip -q "${RELEASE}.zip" @@ -59,9 +74,14 @@ function update_script() { php artisan 2fauth:install + $STD systemctl restart nginx + # Cleaning up msg_info "Cleaning Up" rm -rf "v${RELEASE}.zip" + if dpkg -l | grep -q 'php8.2'; then + $STD apt-get remove --purge -y php8.2* + fi $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleanup Completed" diff --git a/install/2fauth-install.sh b/install/2fauth-install.sh index e7b3af6d0..4f843e306 100644 --- a/install/2fauth-install.sh +++ b/install/2fauth-install.sh @@ -14,10 +14,19 @@ network_check update_os msg_info "Installing Dependencies" + +$STD apt-get install -y \ + lsb-release \ + gpg + +curl -fsSL https://packages.sury.org/php/apt.gpg | gpg --dearmor -o /usr/share/keyrings/deb.sury.org-php.gpg +echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list +$STD apt-get update + $STD apt-get install -y \ nginx \ composer \ - php8.2-{bcmath,common,ctype,curl,fileinfo,fpm,gd,mbstring,mysql,xml,cli} \ + php8.3-{bcmath,common,ctype,curl,fileinfo,fpm,gd,mbstring,mysql,xml,cli} \ mariadb-server msg_ok "Installed Dependencies" @@ -90,7 +99,7 @@ server { error_page 404 /index.php; location ~ \.php\$ { - fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; + fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; fastcgi_param SCRIPT_FILENAME \$realpath_root\$fastcgi_script_name; include fastcgi_params; }