Compare commits

...

13 Commits

Author SHA1 Message Date
CanbiZ
aa26bf81e1 Refactor: setup_php 2025-11-21 22:10:57 +01:00
community-scripts-pr-app[bot]
06d8e5354a Update CHANGELOG.md (#9338)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-11-21 14:34:47 +00:00
community-scripts-pr-app[bot]
60fc5573aa Update CHANGELOG.md (#9337)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-11-21 14:34:11 +00:00
CanbiZ
29ee6cdff3 plex: prevent [] syntax issue (#9318) 2025-11-21 15:34:04 +01:00
community-scripts-pr-app[bot]
bda9286043 Update CHANGELOG.md (#9336)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-11-21 14:33:50 +00:00
Tobias
4389a43670 fix: karakeep strip "v" from release version (#9324)
* fix: karakeep strip "v" from release version

* fix: strip v from release for karakeep version

* Fix MODULE_VERSION and SERVER_VERSION formatting

* formatting
2025-11-21 15:33:44 +01:00
Chris
43877a8b17 NetVisor: fix grep in update (#9334) 2025-11-21 15:33:24 +01:00
CanbiZ
ff6cb3b87e Fix rustup update to avoid interactive prompts
Redirects stdin from /dev/null when running 'rustup update' to prevent any interactive prompts that may block automated scripts.
2025-11-21 15:22:01 +01:00
community-scripts-pr-app[bot]
4b0fb547e9 Update CHANGELOG.md (#9333)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-11-21 13:33:37 +00:00
Chris
e2c6020c64 pin correct version (#9332) 2025-11-21 14:33:09 +01:00
community-scripts-pr-app[bot]
33f4482012 Update versions.json (#9330)
Co-authored-by: GitHub Actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-11-21 13:05:51 +01:00
community-scripts-pr-app[bot]
9b375bccab Update CHANGELOG.md (#9327)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-11-21 07:54:10 +00:00
CanbiZ
3f2f29d352 Refactor IPv6 disable logic and add 'disable' option (#9326)
Replaces previous IPv6 disabling method with a dedicated 'disable' option, storing sysctl settings in /etc/sysctl.d/99-disable-ipv6.conf. Updates build and install scripts to clarify the difference between 'none' (no assignment) and 'disable' (fully disables IPv6), adds user warnings, and disables IPv6 listeners in nginx if present.
2025-11-21 08:53:46 +01:00
11 changed files with 176 additions and 194 deletions

View File

@@ -12,6 +12,19 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
## 2025-11-21 ## 2025-11-21
### 🚀 Updated Scripts
- #### 🐞 Bug Fixes
- plex: prevent [] syntax issue [@MickLesk](https://github.com/MickLesk) ([#9318](https://github.com/community-scripts/ProxmoxVE/pull/9318))
- fix: karakeep strip "v" from release version [@CrazyWolf13](https://github.com/CrazyWolf13) ([#9324](https://github.com/community-scripts/ProxmoxVE/pull/9324))
- NetVisor: fix grep in update [@vhsdream](https://github.com/vhsdream) ([#9334](https://github.com/community-scripts/ProxmoxVE/pull/9334))
- Immich: pin correct version [@vhsdream](https://github.com/vhsdream) ([#9332](https://github.com/community-scripts/ProxmoxVE/pull/9332))
- #### 🔧 Refactor
- Refactor IPv6 disable logic and add 'disable' option [@MickLesk](https://github.com/MickLesk) ([#9326](https://github.com/community-scripts/ProxmoxVE/pull/9326))
## 2025-11-20 ## 2025-11-20
### 🚀 Updated Scripts ### 🚀 Updated Scripts

View File

@@ -82,7 +82,7 @@ function update_script() {
cd /opt/karakeep/packages/db cd /opt/karakeep/packages/db
$STD pnpm migrate $STD pnpm migrate
$STD pnpm store prune $STD pnpm store prune
sed -i "s/^SERVER_VERSION=.*$/SERVER_VERSION=${CHECK_UPDATE_RELEASE}/" /etc/karakeep/karakeep.env sed -i "s/^SERVER_VERSION=.*$/SERVER_VERSION=${CHECK_UPDATE_RELEASE#v}/" /etc/karakeep/karakeep.env
msg_ok "Updated Karakeep" msg_ok "Updated Karakeep"
msg_info "Starting Services" msg_info "Starting Services"

View File

@@ -51,7 +51,7 @@ function update_script() {
cp /opt/netvisor.env.bak /opt/netvisor/.env cp /opt/netvisor.env.bak /opt/netvisor/.env
LOCAL_IP="$(hostname -I | awk '{print $1}')" LOCAL_IP="$(hostname -I | awk '{print $1}')"
if ! grep -q "PUBLIC_URL"; then if ! grep -q "PUBLIC_URL" /opt/netvisor/.env; then
sed -i "\|_PATH=|a\NETVISOR_PUBLIC_URL=http://${LOCAL_IP}:60072" /opt/netvisor/.env sed -i "\|_PATH=|a\NETVISOR_PUBLIC_URL=http://${LOCAL_IP}:60072" /opt/netvisor/.env
fi fi
sed -i 's|_TARGET=.*$|_URL=http://127.0.0.1:60072|' /opt/netvisor/.env sed -i 's|_TARGET=.*$|_URL=http://127.0.0.1:60072|' /opt/netvisor/.env

View File

@@ -23,7 +23,8 @@ function update_script() {
header_info header_info
check_container_storage check_container_storage
check_container_resources check_container_resources
if [ ! -f /etc/apt/sources.list.d/plexmediaserver.list ]] && [[ ! -f /etc/apt/sources.list.d/plexmediaserver.sources ]]; then if [[ ! -f /etc/apt/sources.list.d/plexmediaserver.list ]] \
&& [[ ! -f /etc/apt/sources.list.d/plexmediaserver.sources ]]; then
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi

View File

@@ -1,14 +1,69 @@
[ [
{
"name": "rcourtman/Pulse",
"version": "v4.32.3",
"date": "2025-11-21T11:16:25Z"
},
{
"name": "seriousm4x/UpSnap",
"version": "5.2.4",
"date": "2025-11-21T10:25:05Z"
},
{
"name": "emqx/emqx",
"version": "e6.0.2-beta.2",
"date": "2025-11-21T10:20:27Z"
},
{
"name": "sabnzbd/sabnzbd",
"version": "4.5.5",
"date": "2025-10-24T11:12:22Z"
},
{
"name": "openobserve/openobserve",
"version": "v0.16.3",
"date": "2025-11-21T08:54:06Z"
},
{
"name": "booklore-app/booklore",
"version": "v1.11.0",
"date": "2025-11-21T08:09:03Z"
},
{
"name": "mattermost/mattermost",
"version": "v10.11.7",
"date": "2025-11-17T08:40:53Z"
},
{
"name": "MariaDB/server",
"version": "mariadb-12.1.2",
"date": "2025-11-18T15:16:21Z"
},
{
"name": "morpheus65535/bazarr",
"version": "v1.5.3",
"date": "2025-09-20T12:12:33Z"
},
{
"name": "Jackett/Jackett",
"version": "v0.24.338",
"date": "2025-11-21T05:55:33Z"
},
{
"name": "bluenviron/mediamtx",
"version": "v1.15.4",
"date": "2025-11-21T01:21:03Z"
},
{
"name": "jeedom/core",
"version": "4.4.20",
"date": "2025-11-21T00:27:06Z"
},
{ {
"name": "TasmoAdmin/TasmoAdmin", "name": "TasmoAdmin/TasmoAdmin",
"version": "v4.3.2", "version": "v4.3.2",
"date": "2025-10-18T12:11:00Z" "date": "2025-10-18T12:11:00Z"
}, },
{
"name": "rcourtman/Pulse",
"version": "v4.32.2",
"date": "2025-11-20T22:25:40Z"
},
{ {
"name": "project-zot/zot", "name": "project-zot/zot",
"version": "v2.1.11", "version": "v2.1.11",
@@ -24,6 +79,11 @@
"version": "v3007.9", "version": "v3007.9",
"date": "2025-11-20T17:58:32Z" "date": "2025-11-20T17:58:32Z"
}, },
{
"name": "keycloak/keycloak",
"version": "26.4.5",
"date": "2025-11-12T15:24:23Z"
},
{ {
"name": "msgbyte/tianji", "name": "msgbyte/tianji",
"version": "v1.30.12", "version": "v1.30.12",
@@ -69,21 +129,11 @@
"version": "fumadocs-ui@16.0.15", "version": "fumadocs-ui@16.0.15",
"date": "2025-11-20T10:52:04Z" "date": "2025-11-20T10:52:04Z"
}, },
{
"name": "mattermost/mattermost",
"version": "v10.11.7",
"date": "2025-11-17T08:40:53Z"
},
{ {
"name": "Athou/commafeed", "name": "Athou/commafeed",
"version": "5.12.0", "version": "5.12.0",
"date": "2025-11-20T06:18:58Z" "date": "2025-11-20T06:18:58Z"
}, },
{
"name": "Jackett/Jackett",
"version": "v0.24.336",
"date": "2025-11-20T05:55:54Z"
},
{ {
"name": "documenso/documenso", "name": "documenso/documenso",
"version": "v2.0.14", "version": "v2.0.14",
@@ -104,11 +154,6 @@
"version": "v1.80.0.dev6", "version": "v1.80.0.dev6",
"date": "2025-11-20T02:03:21Z" "date": "2025-11-20T02:03:21Z"
}, },
{
"name": "jeedom/core",
"version": "4.4.20",
"date": "2025-11-20T00:27:04Z"
},
{ {
"name": "steveiliop56/tinyauth", "name": "steveiliop56/tinyauth",
"version": "v4.0.1", "version": "v4.0.1",
@@ -119,11 +164,6 @@
"version": "v4.106.2", "version": "v4.106.2",
"date": "2025-11-20T00:23:05Z" "date": "2025-11-20T00:23:05Z"
}, },
{
"name": "keycloak/keycloak",
"version": "26.4.5",
"date": "2025-11-12T15:24:23Z"
},
{ {
"name": "esphome/esphome", "name": "esphome/esphome",
"version": "2025.11.0", "version": "2025.11.0",
@@ -204,11 +244,6 @@
"version": "v7.5.0", "version": "v7.5.0",
"date": "2025-11-19T08:36:29Z" "date": "2025-11-19T08:36:29Z"
}, },
{
"name": "morpheus65535/bazarr",
"version": "v1.5.3",
"date": "2025-09-20T12:12:33Z"
},
{ {
"name": "element-hq/synapse", "name": "element-hq/synapse",
"version": "v1.143.0rc1", "version": "v1.143.0rc1",
@@ -249,11 +284,6 @@
"version": "v3.6.2", "version": "v3.6.2",
"date": "2025-11-18T16:25:16Z" "date": "2025-11-18T16:25:16Z"
}, },
{
"name": "MariaDB/server",
"version": "mariadb-12.1.2",
"date": "2025-11-18T15:16:21Z"
},
{ {
"name": "redis/redis", "name": "redis/redis",
"version": "8.4.0", "version": "8.4.0",
@@ -269,11 +299,6 @@
"version": "v0.7.5", "version": "v0.7.5",
"date": "2025-11-18T10:50:21Z" "date": "2025-11-18T10:50:21Z"
}, },
{
"name": "emqx/emqx",
"version": "e6.1.0-alpha.1",
"date": "2025-11-18T10:33:45Z"
},
{ {
"name": "wazuh/wazuh", "name": "wazuh/wazuh",
"version": "coverity-w47-4.14.2", "version": "coverity-w47-4.14.2",
@@ -434,11 +459,6 @@
"version": "22.0.3", "version": "22.0.3",
"date": "2025-11-14T14:49:25Z" "date": "2025-11-14T14:49:25Z"
}, },
{
"name": "openobserve/openobserve",
"version": "v0.16.2",
"date": "2025-11-14T12:05:36Z"
},
{ {
"name": "zitadel/zitadel", "name": "zitadel/zitadel",
"version": "v4.7.0", "version": "v4.7.0",
@@ -854,11 +874,6 @@
"version": "cassandra-5.0.6", "version": "cassandra-5.0.6",
"date": "2025-10-29T07:40:47Z" "date": "2025-10-29T07:40:47Z"
}, },
{
"name": "booklore-app/booklore",
"version": "v1.10.0",
"date": "2025-10-28T19:04:35Z"
},
{ {
"name": "pi-hole/pi-hole", "name": "pi-hole/pi-hole",
"version": "v6.2.2", "version": "v6.2.2",
@@ -894,11 +909,6 @@
"version": "v0.25.2", "version": "v0.25.2",
"date": "2025-10-24T12:30:04Z" "date": "2025-10-24T12:30:04Z"
}, },
{
"name": "sabnzbd/sabnzbd",
"version": "4.5.5",
"date": "2025-10-24T11:12:22Z"
},
{ {
"name": "crowdsecurity/crowdsec", "name": "crowdsecurity/crowdsec",
"version": "v1.7.3", "version": "v1.7.3",
@@ -924,11 +934,6 @@
"version": "release-1.24.1", "version": "release-1.24.1",
"date": "2025-10-22T10:28:00Z" "date": "2025-10-22T10:28:00Z"
}, },
{
"name": "bluenviron/mediamtx",
"version": "v1.15.3",
"date": "2025-10-21T19:56:55Z"
},
{ {
"name": "kyantech/Palmr", "name": "kyantech/Palmr",
"version": "v3.2.5-beta", "version": "v3.2.5-beta",
@@ -939,11 +944,6 @@
"version": "v1.71.2", "version": "v1.71.2",
"date": "2025-10-20T15:25:52Z" "date": "2025-10-20T15:25:52Z"
}, },
{
"name": "seriousm4x/UpSnap",
"version": "5.2.3",
"date": "2025-10-19T20:50:15Z"
},
{ {
"name": "Part-DB/Part-DB-server", "name": "Part-DB/Part-DB-server",
"version": "v2.2.1", "version": "v2.2.1",

View File

@@ -290,7 +290,7 @@ GEO_DIR="${INSTALL_DIR}/geodata"
mkdir -p "$INSTALL_DIR" mkdir -p "$INSTALL_DIR"
mkdir -p {"${APP_DIR}","${UPLOAD_DIR}","${GEO_DIR}","${INSTALL_DIR}"/cache} mkdir -p {"${APP_DIR}","${UPLOAD_DIR}","${GEO_DIR}","${INSTALL_DIR}"/cache}
fetch_and_deploy_gh_release "immich" "immich-app/immich" "tarball" "v2.2.3" "$SRC_DIR" fetch_and_deploy_gh_release "immich" "immich-app/immich" "tarball" "v2.3.1" "$SRC_DIR"
msg_info "Installing ${APPLICATION} (patience)" msg_info "Installing ${APPLICATION} (patience)"

View File

@@ -64,7 +64,7 @@ export DATA_DIR=/opt/karakeep_data
karakeep_SECRET=$(openssl rand -base64 36 | cut -c1-24) karakeep_SECRET=$(openssl rand -base64 36 | cut -c1-24)
mkdir -p /etc/karakeep mkdir -p /etc/karakeep
cat <<EOF >/etc/karakeep/karakeep.env cat <<EOF >/etc/karakeep/karakeep.env
SERVER_VERSION="$(cat ~/.karakeep)" SERVER_VERSION="$(sed 's/^v//' ~/.karakeep)"
NEXTAUTH_SECRET="$karakeep_SECRET" NEXTAUTH_SECRET="$karakeep_SECRET"
NEXTAUTH_URL="http://localhost:3000" NEXTAUTH_URL="http://localhost:3000"
DATA_DIR=${DATA_DIR} DATA_DIR=${DATA_DIR}

View File

@@ -13,14 +13,17 @@ load_functions
verb_ip6() { verb_ip6() {
set_std_mode # Set STD mode based on VERBOSE set_std_mode # Set STD mode based on VERBOSE
if [ "$IPV6_METHOD" == "none" ] || [ "$DISABLEIPV6" == "yes" ]; then if [ "$IPV6_METHOD" == "disable" ]; then
msg_info "Disabling IPv6" msg_info "Disabling IPv6 (this may affect some services)"
$STD sysctl -w net.ipv6.conf.all.disable_ipv6=1 $STD sysctl -w net.ipv6.conf.all.disable_ipv6=1
$STD sysctl -w net.ipv6.conf.default.disable_ipv6=1 $STD sysctl -w net.ipv6.conf.default.disable_ipv6=1
$STD sysctl -w net.ipv6.conf.lo.disable_ipv6=1 $STD sysctl -w net.ipv6.conf.lo.disable_ipv6=1
echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf mkdir -p /etc/sysctl.d
echo "net.ipv6.conf.default.disable_ipv6 = 1" >>/etc/sysctl.conf $STD tee /etc/sysctl.d/99-disable-ipv6.conf >/dev/null <<EOF
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >>/etc/sysctl.conf net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
EOF
$STD rc-update add sysctl default $STD rc-update add sysctl default
msg_ok "Disabled IPv6" msg_ok "Disabled IPv6"
fi fi

View File

@@ -627,11 +627,12 @@ advanced_settings() {
# IPv6 Address Management selection # IPv6 Address Management selection
while true; do while true; do
IPV6_METHOD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --menu \ IPV6_METHOD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --menu \
"Select IPv6 Address Management Type:" 15 58 4 \ "Select IPv6 Address Management Type:" 16 70 5 \
"auto" "SLAAC/AUTO (recommended, default)" \ "auto" "SLAAC/AUTO (recommended) - Dynamic IPv6 from network" \
"dhcp" "DHCPv6" \ "dhcp" "DHCPv6 - DHCP-assigned IPv6 address" \
"static" "Static (manual entry)" \ "static" "Static - Manual IPv6 address configuration" \
"none" "Disabled" \ "none" "None - No IPv6 assignment (most containers)" \
"disable" "Fully Disabled - (breaks some services)" \
--default-item "auto" 3>&1 1>&2 2>&3) --default-item "auto" 3>&1 1>&2 2>&3)
[ $? -ne 0 ] && exit_script [ $? -ne 0 ] && exit_script
@@ -680,7 +681,15 @@ advanced_settings() {
break break
;; ;;
none) none)
echo -e "${NETWORK}${BOLD}${DGN}IPv6: ${BGN}Disabled${CL}" echo -e "${NETWORK}${BOLD}${DGN}IPv6: ${BGN}None${CL}"
IPV6_ADDR="none"
IPV6_GATE=""
break
;;
disable)
whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox \
"⚠️ WARNING - FULLY DISABLE IPv6:\n\nThis will completely disable IPv6 inside the container via sysctl.\n\nSide Effects:\n • Services requiring IPv6 will fail\n • Localhost IPv6 (::1) will not work\n • Some applications may not start\n\nOnly use if you have a specific reason to completely disable IPv6.\n\nFor most use cases, select 'None' instead." 14 70
echo -e "${NETWORK}${BOLD}${DGN}IPv6: ${BGN}Fully Disabled (IPv6 disabled via sysctl)${CL}"
IPV6_ADDR="none" IPV6_ADDR="none"
IPV6_GATE="" IPV6_GATE=""
break break

View File

@@ -15,12 +15,16 @@ load_functions
verb_ip6() { verb_ip6() {
set_std_mode # Set STD mode based on VERBOSE set_std_mode # Set STD mode based on VERBOSE
if [ "$IPV6_METHOD" == "none" ] || [ "$DISABLEIPV6" == "yes" ]; then if [ "$IPV6_METHOD" == "disable" ]; then
msg_info "Disabling IPv6" msg_info "Disabling IPv6 (this may affect some services)"
$STD echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf mkdir -p /etc/sysctl.d
$STD echo "net.ipv6.conf.default.disable_ipv6 = 1" >>/etc/sysctl.conf $STD tee /etc/sysctl.d/99-disable-ipv6.conf >/dev/null <<EOF
$STD echo "net.ipv6.conf.lo.disable_ipv6 = 1" >>/etc/sysctl.conf # Disable IPv6 (set by community-scripts)
$STD sysctl -p net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
EOF
$STD sysctl -p /etc/sysctl.d/99-disable-ipv6.conf
msg_ok "Disabled IPv6" msg_ok "Disabled IPv6"
fi fi
} }

View File

@@ -3577,62 +3577,39 @@ function setup_nodejs() {
fi fi
fi fi
} }
# ------------------------------------------------------------------------------
# Installs PHP with selected modules and configures Apache/FPM support.
#
# Description:
# - Adds Sury PHP repo if needed
# - Installs default and user-defined modules
# - Patches php.ini for CLI, Apache, and FPM as needed
#
# Variables:
# PHP_VERSION - PHP version to install (default: 8.4)
# PHP_MODULE - Additional comma-separated modules
# PHP_APACHE - Set YES to enable PHP with Apache
# PHP_FPM - Set YES to enable PHP-FPM
# PHP_MEMORY_LIMIT - (default: 512M)
# PHP_UPLOAD_MAX_FILESIZE - (default: 128M)
# PHP_POST_MAX_SIZE - (default: 128M)
# PHP_MAX_EXECUTION_TIME - (default: 300)
# ------------------------------------------------------------------------------
function setup_php() { function setup_php() {
local PHP_VERSION="${PHP_VERSION:-8.4}" local PHP_VERSION="${PHP_VERSION:-8.4}"
local PHP_MODULE="${PHP_MODULE:-}" local PHP_MODULE="${PHP_MODULE:-}"
local PHP_APACHE="${PHP_APACHE:-NO}" local PHP_APACHE="${PHP_APACHE:-NO}"
local PHP_FPM="${PHP_FPM:-NO}" local PHP_FPM="${PHP_FPM:-NO}"
local DISTRO_ID DISTRO_CODENAME
DISTRO_ID=$(awk -F= '/^ID=/{print $2}' /etc/os-release | tr -d '"')
DISTRO_CODENAME=$(awk -F= '/^VERSION_CODENAME=/{print $2}' /etc/os-release)
local DEFAULT_MODULES="bcmath,cli,curl,gd,intl,mbstring,opcache,readline,xml,zip" local DEFAULT_MODULES="bcmath,cli,curl,gd,intl,mbstring,opcache,readline,xml,zip"
local COMBINED_MODULES local COMBINED_MODULES
local PHP_MEMORY_LIMIT="${PHP_MEMORY_LIMIT:-512M}" local PHP_MEMORY_LIMIT="${PHP_MEMORY_LIMIT:-512M}"
local PHP_UPLOAD_MAX_FILESIZE="${PHP_UPLOAD_MAX_FILESIZE:-128M}" local PHP_UPLOAD_MAX_FILESIZE="${PHP_UPLOAD_MAX_FILESIZE:-128M}"
local PHP_POST_MAX_SIZE="${PHP_POST_MAX_SIZE:-128M}" local PHP_POST_MAX_SIZE="${PHP_POST_MAX_SIZE:-128M}"
local PHP_MAX_EXECUTION_TIME="${PHP_MAX_EXECUTION_TIME:-300}" local PHP_MAX_EXECUTION_TIME="${PHP_MAX_EXECUTION_TIME:-300}"
# Merge default + user-defined modules
if [[ -n "$PHP_MODULE" ]]; then if [[ -n "$PHP_MODULE" ]]; then
COMBINED_MODULES="${DEFAULT_MODULES},${PHP_MODULE}" COMBINED_MODULES="${DEFAULT_MODULES},${PHP_MODULE}"
else else
COMBINED_MODULES="${DEFAULT_MODULES}" COMBINED_MODULES="${DEFAULT_MODULES}"
fi fi
# Deduplicate
COMBINED_MODULES=$(echo "$COMBINED_MODULES" | tr ',' '\n' | awk '!seen[$0]++' | paste -sd, -) COMBINED_MODULES=$(echo "$COMBINED_MODULES" | tr ',' '\n' | awk '!seen[$0]++' | paste -sd, -)
# Get current PHP-CLI version # Ensure PHP version exists
local CURRENT_PHP="" if ! apt-cache show "php${PHP_VERSION}" >/dev/null 2>&1; then
CURRENT_PHP=$(is_tool_installed "php" 2>/dev/null) || true msg_error "PHP ${PHP_VERSION} is not available in repositories"
return 1
fi
# Scenario 1: Already at target version - just update packages # Remove all existing PHP versions
if [[ -n "$CURRENT_PHP" && "$CURRENT_PHP" == "$PHP_VERSION" ]]; then msg_info "Removing existing PHP versions"
msg_info "Update PHP $PHP_VERSION" apt purge -y 'php[0-9]*' >/dev/null 2>&1 || true
msg_ok "Removed existing PHP"
# Ensure Sury repo is available # Ensure Sury repo
if [[ ! -f /etc/apt/sources.list.d/php.sources ]]; then if [[ ! -f /etc/apt/sources.list.d/php.sources ]]; then
manage_tool_repository "php" "$PHP_VERSION" "" "https://packages.sury.org/debsuryorg-archive-keyring.deb" || { manage_tool_repository "php" "$PHP_VERSION" "" "https://packages.sury.org/debsuryorg-archive-keyring.deb" || {
msg_error "Failed to setup PHP repository" msg_error "Failed to setup PHP repository"
@@ -3642,92 +3619,67 @@ function setup_php() {
ensure_apt_working || return 1 ensure_apt_working || return 1
# Perform upgrade with retry logic (non-fatal if fails) # Install base PHP
upgrade_packages_with_retry "php${PHP_VERSION}" || true msg_info "Installing PHP ${PHP_VERSION}"
install_packages_with_retry "php${PHP_VERSION}" || {
cache_installed_version "php" "$PHP_VERSION" msg_error "Failed to install PHP"
msg_ok "Update PHP $PHP_VERSION"
else
# Scenario 2: Different version installed - clean upgrade
if [[ -n "$CURRENT_PHP" && "$CURRENT_PHP" != "$PHP_VERSION" ]]; then
msg_info "Upgrade PHP from $CURRENT_PHP to $PHP_VERSION"
# Stop and disable ALL PHP-FPM versions
stop_all_services "php.*-fpm"
remove_old_tool_version "php"
else
msg_info "Setup PHP $PHP_VERSION"
fi
# Prepare repository (cleanup + validation)
prepare_repository_setup "php" "deb.sury.org-php" || {
msg_error "Failed to prepare PHP repository"
return 1 return 1
} }
# Setup Sury repository # Install modules
manage_tool_repository "php" "$PHP_VERSION" "" "https://packages.sury.org/debsuryorg-archive-keyring.deb" || { IFS=',' read -ra MODULES <<<"${COMBINED_MODULES}"
msg_error "Failed to setup PHP repository"
return 1
}
ensure_apt_working || return 1
fi
# Build module list
local MODULE_LIST="php${PHP_VERSION}"
IFS=',' read -ra MODULES <<<"$COMBINED_MODULES"
for mod in "${MODULES[@]}"; do for mod in "${MODULES[@]}"; do
if apt-cache show "php${PHP_VERSION}-${mod}" >/dev/null 2>&1; then if apt-cache show "php${PHP_VERSION}-${mod}" >/dev/null 2>&1; then
MODULE_LIST+=" php${PHP_VERSION}-${mod}" install_packages_with_retry "php${PHP_VERSION}-${mod}"
else
msg_error "Module not found: php${PHP_VERSION}-${mod}"
fi fi
done done
if [[ "$PHP_FPM" == "YES" ]]; then
MODULE_LIST+=" php${PHP_VERSION}-fpm"
fi
# install apache2 with PHP support if requested # Apache support
if [[ "$PHP_APACHE" == "YES" ]]; then if [[ "$PHP_APACHE" == "YES" ]]; then
if ! dpkg -l 2>/dev/null | grep -q "libapache2-mod-php${PHP_VERSION}"; then
install_packages_with_retry "apache2" "libapache2-mod-php${PHP_VERSION}" || { install_packages_with_retry "apache2" "libapache2-mod-php${PHP_VERSION}" || {
msg_error "Failed to install Apache with PHP module" msg_error "Failed to install Apache PHP module"
return 1 return 1
} }
fi fi
fi
# Install PHP packages with retry logic # PHP-FPM support
install_packages_with_retry $MODULE_LIST || { if [[ "$PHP_FPM" == "YES" ]]; then
msg_error "Failed to install PHP packages" install_packages_with_retry "php${PHP_VERSION}-fpm" || {
msg_error "Failed to install PHP-FPM"
return 1 return 1
} }
cache_installed_version "php" "$PHP_VERSION" fi
# Patch all relevant php.ini files # Activate CLI PHP version
if [[ -x "/usr/bin/php${PHP_VERSION}" ]]; then
update-alternatives --set php "/usr/bin/php${PHP_VERSION}" >/dev/null 2>&1 || true
fi
# Patch php.ini
local PHP_INI_PATHS=("/etc/php/${PHP_VERSION}/cli/php.ini") local PHP_INI_PATHS=("/etc/php/${PHP_VERSION}/cli/php.ini")
[[ "$PHP_FPM" == "YES" ]] && PHP_INI_PATHS+=("/etc/php/${PHP_VERSION}/fpm/php.ini") [[ "$PHP_FPM" == "YES" ]] && PHP_INI_PATHS+=("/etc/php/${PHP_VERSION}/fpm/php.ini")
[[ "$PHP_APACHE" == "YES" ]] && PHP_INI_PATHS+=("/etc/php/${PHP_VERSION}/apache2/php.ini") [[ "$PHP_APACHE" == "YES" ]] && PHP_INI_PATHS+=("/etc/php/${PHP_VERSION}/apache2/php.ini")
for ini in "${PHP_INI_PATHS[@]}"; do for ini in "${PHP_INI_PATHS[@]}"; do
if [[ -f "$ini" ]]; then [[ -f "$ini" ]] || continue
$STD sed -i "s|^memory_limit = .*|memory_limit = ${PHP_MEMORY_LIMIT}|" "$ini" $STD sed -i "s|^memory_limit = .*|memory_limit = ${PHP_MEMORY_LIMIT}|" "$ini"
$STD sed -i "s|^upload_max_filesize = .*|upload_max_filesize = ${PHP_UPLOAD_MAX_FILESIZE}|" "$ini" $STD sed -i "s|^upload_max_filesize = .*|upload_max_filesize = ${PHP_UPLOAD_MAX_FILESIZE}|" "$ini"
$STD sed -i "s|^post_max_size = .*|post_max_size = ${PHP_POST_MAX_SIZE}|" "$ini" $STD sed -i "s|^post_max_size = .*|post_max_size = ${PHP_POST_MAX_SIZE}|" "$ini"
$STD sed -i "s|^max_execution_time = .*|max_execution_time = ${PHP_MAX_EXECUTION_TIME}|" "$ini" $STD sed -i "s|^max_execution_time = .*|max_execution_time = ${PHP_MAX_EXECUTION_TIME}|" "$ini"
fi
done done
# Patch Apache configuration if needed # Apache restart
if [[ "$PHP_APACHE" == "YES" ]]; then if [[ "$PHP_APACHE" == "YES" ]]; then
for mod in $(ls /etc/apache2/mods-enabled/ 2>/dev/null | grep -E '^php[0-9]\.[0-9]\.conf$' | sed 's/\.conf//'); do for mod in $(ls /etc/apache2/mods-enabled/ 2>/dev/null | grep -E '^php[0-9]\.[0-9]\.conf$' | sed 's/\.conf//'); do
if [[ "$mod" != "php${PHP_VERSION}" ]]; then [[ "$mod" == "php${PHP_VERSION}" ]] || $STD a2dismod "$mod" || true
$STD a2dismod "$mod" || true
fi
done done
$STD a2enmod mpm_prefork
$STD a2enmod "php${PHP_VERSION}" $STD a2enmod "php${PHP_VERSION}"
safe_service_restart apache2 || true safe_service_restart apache2 || true
fi fi
# Enable and restart PHP-FPM if requested # FPM restart
if [[ "$PHP_FPM" == "YES" ]]; then if [[ "$PHP_FPM" == "YES" ]]; then
if systemctl list-unit-files | grep -q "php${PHP_VERSION}-fpm.service"; then if systemctl list-unit-files | grep -q "php${PHP_VERSION}-fpm.service"; then
$STD systemctl enable php${PHP_VERSION}-fpm $STD systemctl enable php${PHP_VERSION}-fpm
@@ -3735,7 +3687,7 @@ function setup_php() {
fi fi
fi fi
msg_ok "Setup PHP $PHP_VERSION" msg_ok "Setup PHP ${PHP_VERSION}"
} }
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@@ -4439,7 +4391,7 @@ function setup_rust() {
} }
# Update to latest patch version # Update to latest patch version
$STD rustup update "$RUST_TOOLCHAIN" || true $STD rustup update "$RUST_TOOLCHAIN" </dev/null || true
# Ensure PATH is updated for current shell session # Ensure PATH is updated for current shell session
export PATH="$CARGO_BIN:$PATH" export PATH="$CARGO_BIN:$PATH"