Update PHP to 8.3 (#3510)

This commit is contained in:
Brock Humblet 2025-03-31 11:19:36 -05:00 committed by GitHub
parent 59ebbd37fa
commit dff0c3b713
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 2 deletions

View File

@ -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"

View File

@ -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;
}