diff --git a/.github/workflows/php85.yml b/.github/workflows/php85.yml new file mode 100755 index 0000000..58f0dc4 --- /dev/null +++ b/.github/workflows/php85.yml @@ -0,0 +1,87 @@ +name: PHP Composer install tests - PHP 8.5 + +on: + push: + branches: [ "FRAMEWORK_6_0" ] + pull_request: + branches: [ "FRAMEWORK_6_0" ] + schedule: + - cron: "0 0 */2 * *" + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install PHP 8.5 with all Horde extensions + run: sudo bash scripts/install-ubuntu-24.04.sh + + - name: Set PHP 8.5 as default + run: | + sudo update-alternatives --set php /usr/bin/php8.5 + which php + php --version + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php85-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php85- + + - name: Install dependencies for composer.json as-is + run: composer install --prefer-dist --no-progress + + - name: Install passwd app + run: composer require horde/passwd --prefer-dist --no-progress + + - name: Install content tagger app + run: composer require horde/content --prefer-dist --no-progress + + - name: Install timeobjects app + run: composer require horde/timeobjects --prefer-dist --no-progress + + - name: Install mnemo notes app + run: composer require horde/mnemo --prefer-dist --no-progress + + - name: Install ingo mail filter app + run: composer require horde/ingo --prefer-dist --no-progress + + - name: Install turba addressbook app + run: composer require horde/turba --prefer-dist --no-progress + + - name: Install kronolith calendar app + run: composer require horde/kronolith --prefer-dist --no-progress + + - name: Install whups ticketing app + run: composer require horde/whups --prefer-dist --no-progress + + - name: Install trean bookmarks app + run: composer require horde/trean --prefer-dist --no-progress + + - name: Install chora version control system viewer + run: composer require horde/chora --prefer-dist --no-progress + + - name: Install jonah rss feed app + run: composer require horde/jonah --prefer-dist --no-progress + + - name: Install gollem file manager + run: composer require horde/gollem --prefer-dist --no-progress + + # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" + # Docs: https://getcomposer.org/doc/articles/scripts.md + + # - name: Run test suite + # run: composer run-script test diff --git a/scripts/horde-dev-server.sh b/scripts/horde-dev-server.sh new file mode 100755 index 0000000..20bd2e7 --- /dev/null +++ b/scripts/horde-dev-server.sh @@ -0,0 +1,183 @@ +#!/bin/bash +# +# Horde Development Server +# +# Runs PHP's built-in development server for Horde +# Default: localhost:8585 serving /srv/www/horde-dev/web +# +# Usage: +# horde-dev-server.sh # localhost:8585 +# horde-dev-server.sh -p 8080 # localhost:8080 +# horde-dev-server.sh -a # 0.0.0.0:8585 (all interfaces) +# horde-dev-server.sh -a -p 9000 # 0.0.0.0:9000 +# horde-dev-server.sh --php 8.4 # Use PHP 8.4 +# + +set -e +set -u + +# Color output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +log_info() { + echo -e "${GREEN}[INFO]${NC} $1" +} + +log_warn() { + echo -e "${YELLOW}[WARN]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +# Default configuration +DOCUMENT_ROOT="/srv/www/horde-dev/web" +HOST="localhost" +PORT="8585" +PHP_VERSION="" + +# Parse command line arguments +show_help() { + cat << EOF +Horde Development Server + +Usage: $(basename "$0") [OPTIONS] + +Options: + -a, --all-interfaces Listen on all interfaces (0.0.0.0) instead of localhost + -p, --port PORT Port number (default: 8585) + -d, --docroot PATH Document root directory (default: /srv/www/horde-dev/web) + --php VERSION PHP version to use (e.g., 8.3, 8.4, 8.5) + -h, --help Show this help message + +Examples: + $(basename "$0") # Start server on localhost:8585 + $(basename "$0") -p 8080 # Start server on localhost:8080 + $(basename "$0") -a # Start server on 0.0.0.0:8585 + $(basename "$0") -a -p 9000 # Start server on 0.0.0.0:9000 + $(basename "$0") --php 8.4 # Use PHP 8.4 + $(basename "$0") -a -p 8080 --php 8.5 # All options combined + +EOF +} + +while [[ $# -gt 0 ]]; do + case "$1" in + -a|--all-interfaces) + HOST="0.0.0.0" + shift + ;; + -p|--port) + PORT="$2" + shift 2 + ;; + -d|--docroot) + DOCUMENT_ROOT="$2" + shift 2 + ;; + --php) + PHP_VERSION="$2" + shift 2 + ;; + -h|--help) + show_help + exit 0 + ;; + *) + log_error "Unknown option: $1" + echo "" + show_help + exit 1 + ;; + esac +done + +# Validate port number +if ! [[ "$PORT" =~ ^[0-9]+$ ]] || [ "$PORT" -lt 1 ] || [ "$PORT" -gt 65535 ]; then + log_error "Invalid port number: $PORT (must be between 1 and 65535)" + exit 1 +fi + +# Check if document root exists +if [ ! -d "$DOCUMENT_ROOT" ]; then + log_error "Document root does not exist: $DOCUMENT_ROOT" + exit 1 +fi + +# Determine PHP binary to use +if [ -n "$PHP_VERSION" ]; then + PHP_BINARY="php${PHP_VERSION}" + if ! command -v "$PHP_BINARY" >/dev/null 2>&1; then + log_error "PHP version $PHP_VERSION not found (tried: $PHP_BINARY)" + log_info "Available PHP versions:" + ls -1 /usr/bin/php[0-9]* 2>/dev/null || echo " None found" + exit 1 + fi +else + PHP_BINARY="php" +fi + +# Get PHP version info +PHP_VERSION_INFO=$("$PHP_BINARY" -v | head -n 1) + +# Check if port is already in use +if command -v ss >/dev/null 2>&1; then + if ss -tuln | grep -q ":${PORT} "; then + log_error "Port $PORT is already in use" + log_info "Active ports:" + ss -tuln | grep LISTEN | grep ":${PORT} " || true + exit 1 + fi +elif command -v netstat >/dev/null 2>&1; then + if netstat -tuln | grep -q ":${PORT} "; then + log_error "Port $PORT is already in use" + log_info "Active ports:" + netstat -tuln | grep LISTEN | grep ":${PORT} " || true + exit 1 + fi +fi + +# Display server information +echo "" +echo "======================================" +echo " Horde Development Server" +echo "======================================" +echo "" +echo " Document Root: $DOCUMENT_ROOT" +echo " PHP Version: $PHP_VERSION_INFO" +echo " Listen Address: ${HOST}:${PORT}" +echo "" + +if [ "$HOST" = "0.0.0.0" ]; then + log_warn "Server is listening on ALL network interfaces" + log_warn "This exposes Horde to your local network" + echo "" + log_info "Access URLs:" + echo " http://localhost:${PORT}/" + # Try to get local IP addresses + if command -v ip >/dev/null 2>&1; then + LOCAL_IPS=$(ip -4 addr show | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | grep -v '127.0.0.1' || true) + if [ -n "$LOCAL_IPS" ]; then + while IFS= read -r IP; do + echo " http://${IP}:${PORT}/" + done <<< "$LOCAL_IPS" + fi + fi +else + log_info "Access URL: http://localhost:${PORT}/" +fi + +echo "" +log_info "Starting PHP built-in server..." +log_info "Press Ctrl+C to stop" +echo "" +echo "--------------------------------------" + +# Start the server +cd "$DOCUMENT_ROOT" +exec "$PHP_BINARY" -S "${HOST}:${PORT}" -t "$DOCUMENT_ROOT" diff --git a/scripts/install-ubuntu-24.04-developer-tools.sh b/scripts/install-ubuntu-24.04-developer-tools.sh new file mode 100755 index 0000000..de3dfbf --- /dev/null +++ b/scripts/install-ubuntu-24.04-developer-tools.sh @@ -0,0 +1,294 @@ +#!/bin/bash +# +# Horde Developer Tools Setup for Ubuntu 24.04 LTS (Noble) +# +# This script is idempotent - safe to run multiple times +# Installs PHP versions (via install-ubuntu-24.04.sh) and developer tools via PHIVE +# +# Usage: sudo bash install-ubuntu-24.04-developer-tools.sh +# + +set -e # Exit on error +set -u # Exit on undefined variable + +# Color output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +BLUE='\033[0;34m' +NC='\033[0m' # No Color + +log_info() { + echo -e "${GREEN}[INFO]${NC} $1" +} + +log_warn() { + echo -e "${YELLOW}[WARN]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +log_step() { + echo -e "${BLUE}[STEP]${NC} $1" +} + +# Check if running as root +if [ "$EUID" -ne 0 ]; then + log_error "This script must be run as root (use sudo)" + exit 1 +fi + +log_info "Starting Horde developer tools setup for Ubuntu 24.04..." + +# Determine script directory +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PHP_INSTALL_SCRIPT="${SCRIPT_DIR}/install-ubuntu-24.04.sh" + +# Step 1: Run PHP installation script +log_step "Step 1: Installing PHP versions and extensions" +if [ -f "$PHP_INSTALL_SCRIPT" ]; then + log_info "Running PHP installation script: $PHP_INSTALL_SCRIPT" + bash "$PHP_INSTALL_SCRIPT" +else + log_error "PHP installation script not found at: $PHP_INSTALL_SCRIPT" + exit 1 +fi + +echo "" +log_step "Step 2: Installing PHIVE (PHar Installation and Verification Environment)" + +# PHIVE installation directories +PHIVE_HOME="/usr/local/lib/phive" +PHIVE_BIN="/usr/local/bin/phive" +TOOLS_DIR="/usr/local/bin" + +# Check if PHIVE is already installed +if command -v phive >/dev/null 2>&1; then + CURRENT_VERSION=$(phive --version | grep -oP 'version \K[0-9.]+' || echo "unknown") + log_info "PHIVE already installed (version: ${CURRENT_VERSION})" +else + log_info "Installing PHIVE..." + + # Install prerequisites + apt-get install -y -qq wget gnupg + + # Download PHIVE installer + wget -q -O phive-installer.phar "https://phar.io/releases/phive.phar" + wget -q -O phive-installer.phar.asc "https://phar.io/releases/phive.phar.asc" + + # Import PHIVE GPG keys + log_info "Importing PHIVE GPG keys..." + gpg --keyserver hkps://keys.openpgp.org --recv-keys 0x9D8A98B29B2D5D79 2>/dev/null || \ + gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 0x9D8A98B29B2D5D79 2>/dev/null || \ + log_warn "Could not import GPG key from keyserver, signature verification may fail" + + # Verify signature (don't fail if verification fails) + if gpg --verify phive-installer.phar.asc phive-installer.phar 2>/dev/null; then + log_info "PHIVE signature verified successfully" + else + log_warn "Could not verify PHIVE signature, continuing anyway..." + fi + + # Install PHIVE + chmod +x phive-installer.phar + mv phive-installer.phar "$PHIVE_BIN" + rm -f phive-installer.phar.asc + + log_info "PHIVE installed successfully" +fi + +# Verify PHIVE installation +if ! command -v phive >/dev/null 2>&1; then + log_error "PHIVE installation failed" + exit 1 +fi + +PHIVE_VERSION=$(phive --version | head -n 1) +log_info "PHIVE version: $PHIVE_VERSION" + +echo "" +log_step "Step 3: Installing developer tools via PHIVE" + +# Configure PHIVE to install globally +export PHIVE_HOME="$PHIVE_HOME" + +# Function to install tool via PHIVE +install_phive_tool() { + local TOOL_NAME="$1" + local TOOL_ALIAS="$2" + + log_info "Installing ${TOOL_NAME}..." + + # Check if already installed + if [ -f "${TOOLS_DIR}/${TOOL_ALIAS%%@*}" ]; then + INSTALLED_TOOL="${TOOLS_DIR}/${TOOL_ALIAS%%@*}" + log_info "${TOOL_NAME} already installed at ${INSTALLED_TOOL}" + + # Get version + if [ -x "$INSTALLED_TOOL" ]; then + TOOL_VERSION=$("$INSTALLED_TOOL" --version 2>/dev/null | head -n 1 || echo "unknown version") + log_info "Current version: ${TOOL_VERSION}" + fi + else + # Install fresh - accept unsigned for simplicity + log_info "Installing ${TOOL_ALIAS} globally..." + if phive install "$TOOL_ALIAS" --global --force-accept-unsigned --copy 2>&1 | tee /tmp/phive-install.log; then + log_info "${TOOL_NAME} installed successfully" + else + log_warn "Failed to install ${TOOL_NAME} via PHIVE" + return 1 + fi + fi +} + +# Install Composer +log_info "Installing Composer..." +if command -v composer >/dev/null 2>&1; then + COMPOSER_VERSION=$(composer --version 2>/dev/null | grep -oP 'version \K[0-9.]+' || echo "unknown") + log_info "Composer already installed (version: ${COMPOSER_VERSION})" + log_info "Updating Composer..." + composer self-update 2>/dev/null || log_warn "Could not update Composer" +else + log_info "Downloading Composer installer..." + EXPECTED_CHECKSUM="$(wget -q -O - https://composer.github.io/installer.sig)" + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" + + if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then + log_error "Composer installer checksum mismatch" + rm composer-setup.php + exit 1 + fi + + php composer-setup.php --quiet --install-dir=/usr/local/bin --filename=composer + rm composer-setup.php + log_info "Composer installed successfully" +fi + +# Install PHPUnit (latest two major versions) +log_info "Installing PHPUnit versions..." + +# PHPUnit 11 (latest) +if install_phive_tool "PHPUnit 11" "phpunit@^11"; then + # Create phpunit11 alias + if [ -L "${TOOLS_DIR}/phpunit" ] && [ ! -e "${TOOLS_DIR}/phpunit11" ]; then + ln -sf "$(readlink ${TOOLS_DIR}/phpunit)" "${TOOLS_DIR}/phpunit11" 2>/dev/null || true + fi +fi + +# PHPUnit 10 +if install_phive_tool "PHPUnit 10" "phpunit@^10"; then + # If PHPUnit 11 wasn't installed, the main phpunit might be v10 + if [ -L "${TOOLS_DIR}/phpunit" ] && [ ! -e "${TOOLS_DIR}/phpunit10" ]; then + PHPUNIT_VERSION=$(${TOOLS_DIR}/phpunit --version 2>/dev/null | grep -oP 'PHPUnit \K[0-9]+' || echo "0") + if [ "$PHPUNIT_VERSION" = "10" ]; then + ln -sf "$(readlink ${TOOLS_DIR}/phpunit)" "${TOOLS_DIR}/phpunit10" 2>/dev/null || true + fi + fi +fi + +# Install PHP-CS-Fixer +install_phive_tool "PHP-CS-Fixer" "php-cs-fixer" + +# Install PHPStan +install_phive_tool "PHPStan" "phpstan" + +# Install Dephpend +install_phive_tool "Dephpend" "dephpend" + +echo "" +log_step "Step 4: Verifying installations" + +# Verify all tools +echo "" +echo "Installed Developer Tools:" +echo "==========================" + +# Composer +if command -v composer >/dev/null 2>&1; then + COMPOSER_VERSION=$(composer --version 2>/dev/null | head -n 1) + echo " ✓ Composer: ${COMPOSER_VERSION}" +else + echo " ✗ Composer: NOT FOUND" +fi + +# PHPUnit +if command -v phpunit >/dev/null 2>&1; then + PHPUNIT_VERSION=$(phpunit --version 2>/dev/null | head -n 1) + echo " ✓ PHPUnit: ${PHPUNIT_VERSION}" +else + echo " ✗ PHPUnit: NOT FOUND" +fi + +# Check for PHPUnit 10/11 specifically +if [ -f "${TOOLS_DIR}/phpunit11" ]; then + PHPUNIT11_VERSION=$(${TOOLS_DIR}/phpunit11 --version 2>/dev/null | head -n 1 || echo "unknown") + echo " ✓ PHPUnit 11: ${PHPUNIT11_VERSION}" +fi + +if [ -f "${TOOLS_DIR}/phpunit10" ]; then + PHPUNIT10_VERSION=$(${TOOLS_DIR}/phpunit10 --version 2>/dev/null | head -n 1 || echo "unknown") + echo " ✓ PHPUnit 10: ${PHPUNIT10_VERSION}" +fi + +# PHP-CS-Fixer +if command -v php-cs-fixer >/dev/null 2>&1; then + PHPCS_VERSION=$(php-cs-fixer --version 2>/dev/null | head -n 1) + echo " ✓ PHP-CS-Fixer: ${PHPCS_VERSION}" +else + echo " ✗ PHP-CS-Fixer: NOT FOUND" +fi + +# PHPStan +if command -v phpstan >/dev/null 2>&1; then + PHPSTAN_VERSION=$(phpstan --version 2>/dev/null | head -n 1) + echo " ✓ PHPStan: ${PHPSTAN_VERSION}" +else + echo " ✗ PHPStan: NOT FOUND" +fi + +# Dephpend +if command -v dephpend >/dev/null 2>&1; then + DEPHPEND_VERSION=$(dephpend --version 2>/dev/null | head -n 1 || echo "Dephpend (version unknown)") + echo " ✓ Dephpend: ${DEPHPEND_VERSION}" +else + echo " ✗ Dephpend: NOT FOUND" +fi + +# PHIVE +if command -v phive >/dev/null 2>&1; then + PHIVE_VERSION=$(phive --version 2>/dev/null | head -n 1) + echo " ✓ PHIVE: ${PHIVE_VERSION}" +else + echo " ✗ PHIVE: NOT FOUND" +fi + +echo "" +log_info "Installation complete!" +echo "" +echo "Summary:" +echo "========" +echo " - PHP 8.3, 8.4, and 8.5 installed with extensions" +echo " - PHIVE installed for PHAR management" +echo " - Composer installed globally" +echo " - PHPUnit 10 and 11 installed" +echo " - PHP-CS-Fixer installed" +echo " - PHPStan installed" +echo " - Dephpend installed" +echo "" +echo "Usage:" +echo " composer --version" +echo " phpunit --version" +echo " phpunit10 --version # PHPUnit 10.x" +echo " phpunit11 --version # PHPUnit 11.x" +echo " php-cs-fixer --version" +echo " phpstan --version" +echo " dephpend --version" +echo " phive list --global # List all PHIVE-managed tools" +echo "" +echo "To update tools:" +echo " composer self-update" +echo " phive update --global" +echo "" diff --git a/scripts/install-ubuntu-24.04.sh b/scripts/install-ubuntu-24.04.sh new file mode 100755 index 0000000..56fb57a --- /dev/null +++ b/scripts/install-ubuntu-24.04.sh @@ -0,0 +1,200 @@ +#!/bin/bash +# +# Horde Development Environment Setup for Ubuntu 24.04 LTS (Noble) +# +# This script is idempotent - safe to run multiple times +# Installs PHP 8.3, 8.4, and 8.5 with required extensions for Horde +# Sets PHP 8.3 as the default version +# +# Usage: sudo bash install-ubuntu-24.04.sh +# + +set -e # Exit on error +set -u # Exit on undefined variable + +# Color output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +log_info() { + echo -e "${GREEN}[INFO]${NC} $1" +} + +log_warn() { + echo -e "${YELLOW}[WARN]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +# Check if running as root +if [ "$EUID" -ne 0 ]; then + log_error "This script must be run as root (use sudo)" + exit 1 +fi + +log_info "Starting Horde development environment setup for Ubuntu 24.04..." + +# Update package list +log_info "Updating package lists..." +apt-get update -qq + +# Install prerequisites for adding PPAs +log_info "Installing prerequisites..." +apt-get install -y -qq software-properties-common apt-transport-https ca-certificates curl gnupg lsb-release + +# Add ondrej/php PPA if not already added +if ! grep -q "^deb .*ondrej/php" /etc/apt/sources.list /etc/apt/sources.list.d/* 2>/dev/null; then + log_info "Adding ondrej/php PPA..." + add-apt-repository -y ppa:ondrej/php + apt-get update -qq +else + log_info "ondrej/php PPA already configured" +fi + +# Define PHP versions to install +PHP_VERSIONS=("8.3" "8.4" "8.5") +DEFAULT_PHP_VERSION="8.3" + +# Core PHP extensions required by Horde +# Based on horde/base, horde/Core, horde/components composer.json requirements +# and common Horde library dependencies +CORE_EXTENSIONS=( + "cli" # Command-line interface + "common" # Common files + "fpm" # FastCGI Process Manager + "bcmath" # Arbitrary precision mathematics + "curl" # cURL support + "gd" # GD graphics library + "intl" # Internationalization + "mbstring" # Multibyte string support + "mysql" # MySQL/MariaDB (mysqli + pdo_mysql) + "xml" # XML support (dom, simplexml, xml, xmlreader, xmlwriter) + "zip" # ZIP archive support + "soap" # SOAP protocol support + "ldap" # LDAP support + "imap" # IMAP support + "tidy" # Tidy HTML support + "readline" # Readline support for CLI + "bz2" # Bzip2 compression +) + +# Extensions that should be checked for availability before installing +CHECKED_EXTENSIONS=( + "opcache" # Zend OPcache (may not be available for bleeding-edge PHP) +) + +# Optional but recommended extensions +OPTIONAL_EXTENSIONS=( + "apcu" # APCu caching + "memcached" # Memcached support + "imagick" # ImageMagick support + "redis" # Redis support + "xsl" # XSL transformations + "pgsql" # PostgreSQL support +) + +# Install PHP versions and extensions +for VERSION in "${PHP_VERSIONS[@]}"; do + log_info "Installing PHP ${VERSION}..." + + # Build package list for this version + PACKAGES=() + PACKAGES+=("php${VERSION}") + + # Add core extensions + for EXT in "${CORE_EXTENSIONS[@]}"; do + PACKAGES+=("php${VERSION}-${EXT}") + done + + # Add checked extensions (don't fail if not available) + for EXT in "${CHECKED_EXTENSIONS[@]}"; do + if apt-cache show "php${VERSION}-${EXT}" >/dev/null 2>&1; then + PACKAGES+=("php${VERSION}-${EXT}") + else + log_warn "Extension php${VERSION}-${EXT} not available, skipping" + fi + done + + # Add optional extensions (don't fail if not available) + for EXT in "${OPTIONAL_EXTENSIONS[@]}"; do + if apt-cache show "php${VERSION}-${EXT}" >/dev/null 2>&1; then + PACKAGES+=("php${VERSION}-${EXT}") + else + log_warn "Optional extension php${VERSION}-${EXT} not available" + fi + done + + # Install all packages for this version + log_info "Installing ${#PACKAGES[@]} packages for PHP ${VERSION}..." + apt-get install -y -qq "${PACKAGES[@]}" + + log_info "PHP ${VERSION} installation complete" +done + +# Set default PHP version using update-alternatives +log_info "Setting PHP ${DEFAULT_PHP_VERSION} as default..." + +# Only set if not already the default +CURRENT_DEFAULT=$(update-alternatives --query php 2>/dev/null | grep "^Value:" | awk '{print $2}' || echo "") +DESIRED_DEFAULT="/usr/bin/php${DEFAULT_PHP_VERSION}" + +if [ "$CURRENT_DEFAULT" != "$DESIRED_DEFAULT" ]; then + update-alternatives --set php "$DESIRED_DEFAULT" + log_info "Default PHP set to ${DEFAULT_PHP_VERSION}" +else + log_info "PHP ${DEFAULT_PHP_VERSION} is already the default" +fi + +# Verify installations +log_info "Verifying PHP installations..." +echo "" +echo "Installed PHP versions:" +echo "=======================" + +for VERSION in "${PHP_VERSIONS[@]}"; do + if command -v "php${VERSION}" >/dev/null 2>&1; then + FULL_VERSION=$("php${VERSION}" -r "echo PHP_VERSION;") + echo " PHP ${VERSION}: ${FULL_VERSION}" + else + log_error "PHP ${VERSION} not found!" + fi +done + +echo "" +DEFAULT_VERSION=$(php -r "echo PHP_VERSION;") +echo "Default PHP version: ${DEFAULT_VERSION}" +echo "" + +# Display FPM status +log_info "PHP-FPM status (installed but not configured):" +for VERSION in "${PHP_VERSIONS[@]}"; do + if systemctl list-unit-files | grep -q "php${VERSION}-fpm.service"; then + STATUS=$(systemctl is-enabled "php${VERSION}-fpm.service" 2>/dev/null || echo "disabled") + echo " php${VERSION}-fpm: ${STATUS}" + fi +done + +echo "" +log_info "Installation complete!" +echo "" +echo "Summary:" +echo "========" +echo " - PHP 8.3, 8.4, and 8.5 installed with required extensions" +echo " - Default PHP: ${DEFAULT_PHP_VERSION}" +echo " - PHP-FPM installed but not started/enabled" +echo " - All core Horde extensions installed" +echo "" +echo "Usage:" +echo " Default PHP: php --version" +echo " PHP 8.3: php8.3 --version" +echo " PHP 8.4: php8.4 --version" +echo " PHP 8.5: php8.5 --version" +echo "" +echo "To start PHP-FPM for a specific version:" +echo " systemctl start php8.3-fpm" +echo " systemctl enable php8.3-fpm" +echo ""