Skip to content

Commit dff0c3b

Browse files
authored
Update PHP to 8.3 (#3510)
1 parent 59ebbd3 commit dff0c3b

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

ct/2fauth.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,23 @@ function update_script() {
4141
# Creating Backup
4242
msg_info "Creating Backup"
4343
mv "/opt/2fauth" "/opt/2fauth-backup"
44+
if ! dpkg -l | grep -q 'php8.3'; then
45+
cp /etc/nginx/conf.d/2fauth.conf /etc/nginx/conf.d/2fauth.conf.bak
46+
fi
4447
msg_ok "Backup Created"
4548

49+
# Upgrade PHP
50+
if ! dpkg -l | grep -q 'php8.3'; then
51+
$STD apt-get install -y \
52+
lsb-release \
53+
gpg
54+
curl -fsSL https://packages.sury.org/php/apt.gpg | gpg --dearmor -o /usr/share/keyrings/deb.sury.org-php.gpg
55+
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
56+
$STD apt-get update
57+
$STD apt-get install -y php8.3-{bcmath,common,ctype,curl,fileinfo,fpm,gd,mbstring,mysql,xml,cli,intl}
58+
sed -i 's/php8.2/php8.3/g' /etc/nginx/conf.d/2fauth.conf
59+
fi
60+
4661
# Execute Update
4762
wget -q "https://github.com/Bubka/2FAuth/archive/refs/tags/${RELEASE}.zip"
4863
unzip -q "${RELEASE}.zip"
@@ -59,9 +74,14 @@ function update_script() {
5974

6075
php artisan 2fauth:install
6176

77+
$STD systemctl restart nginx
78+
6279
# Cleaning up
6380
msg_info "Cleaning Up"
6481
rm -rf "v${RELEASE}.zip"
82+
if dpkg -l | grep -q 'php8.2'; then
83+
$STD apt-get remove --purge -y php8.2*
84+
fi
6585
$STD apt-get -y autoremove
6686
$STD apt-get -y autoclean
6787
msg_ok "Cleanup Completed"

install/2fauth-install.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,19 @@ network_check
1414
update_os
1515

1616
msg_info "Installing Dependencies"
17+
18+
$STD apt-get install -y \
19+
lsb-release \
20+
gpg
21+
22+
curl -fsSL https://packages.sury.org/php/apt.gpg | gpg --dearmor -o /usr/share/keyrings/deb.sury.org-php.gpg
23+
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
24+
$STD apt-get update
25+
1726
$STD apt-get install -y \
1827
nginx \
1928
composer \
20-
php8.2-{bcmath,common,ctype,curl,fileinfo,fpm,gd,mbstring,mysql,xml,cli} \
29+
php8.3-{bcmath,common,ctype,curl,fileinfo,fpm,gd,mbstring,mysql,xml,cli} \
2130
mariadb-server
2231
msg_ok "Installed Dependencies"
2332

@@ -90,7 +99,7 @@ server {
9099
error_page 404 /index.php;
91100
92101
location ~ \.php\$ {
93-
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
102+
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
94103
fastcgi_param SCRIPT_FILENAME \$realpath_root\$fastcgi_script_name;
95104
include fastcgi_params;
96105
}

0 commit comments

Comments
 (0)