31 lines
1.2 KiB
Bash
31 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
# ADPanel privileged job: install PHP-FPM + phpMyAdmin.
|
|
# Invoked via adpanel-priv: adpanel-priv job install-phpmyadmin
|
|
set -u
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
apt-get update -qq
|
|
|
|
# Install PHP-FPM and required extensions first
|
|
apt-get install -y --no-install-recommends \
|
|
php-fpm php-mysql php-mbstring php-zip php-gd php-curl php-xml php-cli
|
|
|
|
# Install phpMyAdmin (skip Apache recommends)
|
|
apt-get install -y --no-install-recommends phpmyadmin
|
|
|
|
# If Apache was pulled in anyway, stop and disable it - nginx handles traffic
|
|
if systemctl is-active apache2 >/dev/null 2>&1; then
|
|
systemctl stop apache2 2>/dev/null || true
|
|
fi
|
|
systemctl disable apache2 2>/dev/null || true
|
|
|
|
# Ensure PHP-FPM is running (prefer the newest installed version)
|
|
PHP_FPM_SVC=$(systemctl list-units --type=service --state=running,exited --no-legend 2>/dev/null | grep -oP 'php[\d.]+-fpm\.service' | sort -rV | head -1)
|
|
if [ -z "$PHP_FPM_SVC" ]; then
|
|
PHP_FPM_SVC=$(systemctl list-unit-files --type=service --no-legend 2>/dev/null | grep -oP 'php[\d.]+-fpm\.service' | sort -rV | head -1)
|
|
fi
|
|
if [ -n "$PHP_FPM_SVC" ]; then
|
|
systemctl enable "$PHP_FPM_SVC" 2>/dev/null || true
|
|
systemctl restart "$PHP_FPM_SVC" 2>/dev/null || true
|
|
fi
|