Skip to content

Add development environment setup and server scripts#2

Merged
ralflang merged 2 commits intoFRAMEWORK_6_0from
dev-tools-scripts
Feb 26, 2026
Merged

Add development environment setup and server scripts#2
ralflang merged 2 commits intoFRAMEWORK_6_0from
dev-tools-scripts

Conversation

@ralflang
Copy link
Member

Summary

Add three new utility scripts to streamline Horde development environment setup and local testing.

New Scripts

1. install-ubuntu-24.04.sh

Idempotent PHP installation script for Ubuntu 24.04 (Noble):

  • Installs PHP 8.3, 8.4, and 8.5 from ondrej/php PPA
  • Installs all required Horde extensions: cli, fpm, bcmath, curl, gd, intl, mbstring, mysql, xml, zip, soap, ldap, imap, tidy, readline, bz2
  • Installs optional extensions: apcu, memcached, imagick, redis, xsl, pgsql
  • Sets PHP 8.3 as default version
  • Configures PHP-FPM for all versions

2. install-ubuntu-24.04-developer-tools.sh

Developer tools installation script:

  • Calls install-ubuntu-24.04.sh to ensure PHP is installed
  • Installs PHIVE (PHar Installation and Verification Environment) from https://phar.io/
  • Installs developer tools globally via PHIVE and Composer:
    • Composer (official installer)
    • PHPUnit 10 and 11
    • PHP-CS-Fixer
    • PHPStan
    • Dephpend
  • Idempotent - safe to run multiple times

3. horde-dev-server.sh

PHP development server wrapper for Horde:

  • Runs PHP built-in development server
  • Default: localhost:8585 serving /srv/www/horde-dev/web
  • Options:
    • -a, --all-interfaces - Listen on 0.0.0.0 (all network interfaces)
    • -p, --port PORT - Custom port number
    • -d, --docroot PATH - Custom document root
    • --php VERSION - Use specific PHP version (8.3, 8.4, 8.5)
    • -h, --help - Show help message
  • Safety features:
    • Port conflict detection
    • Security warnings when exposing on all interfaces
    • Automatic detection and display of access URLs

Testing

All scripts have been tested and verified:

  • ✅ install-ubuntu-24.04.sh successfully installs PHP 8.3, 8.4, 8.5
  • ✅ install-ubuntu-24.04-developer-tools.sh successfully installs all dev tools
  • ✅ horde-dev-server.sh successfully serves Horde installation
  • ✅ All scripts are idempotent
  • ✅ All scripts include comprehensive help text

Usage

# Install PHP
sudo bash scripts/install-ubuntu-24.04.sh

# Install developer tools
sudo bash scripts/install-ubuntu-24.04-developer-tools.sh

# Start development server (default: localhost:8585)
bash scripts/horde-dev-server.sh

# Start on all interfaces with custom port
bash scripts/horde-dev-server.sh -a -p 9000

# Use specific PHP version
bash scripts/horde-dev-server.sh --php 8.5

Add three new utility scripts to streamline Horde development:

1. install-ubuntu-24.04.sh
   - Idempotent installation of PHP 8.3, 8.4, and 8.5
   - Installs all required Horde extensions (cli, fpm, bcmath, curl,
     gd, intl, mbstring, mysql, xml, zip, soap, ldap, imap, tidy, etc.)
   - Configures ondrej/php PPA for Ubuntu 24.04 (Noble)
   - Sets PHP 8.3 as default version
   - Installs PHP-FPM for all versions

2. install-ubuntu-24.04-developer-tools.sh
   - Calls install-ubuntu-24.04.sh to ensure PHP is installed
   - Installs PHIVE (PHar Installation and Verification Environment)
   - Installs developer tools globally: Composer, PHPUnit 10/11,
     PHP-CS-Fixer, PHPStan, and Dephpend
   - Idempotent - safe to run multiple times

3. horde-dev-server.sh
   - Runs PHP built-in development server for Horde
   - Default: localhost:8585 serving /srv/www/horde-dev/web
   - Options: -a (all interfaces), -p (port), --php (version)
   - Includes port conflict detection and security warnings
   - Displays all available access URLs when using all interfaces

All scripts are idempotent and include comprehensive help text.
Add a new GitHub Actions workflow for testing PHP 8.5 compatibility.

This workflow demonstrates the simplified approach enabled by the new
install-ubuntu-24.04.sh script:

- Single-line PHP installation (vs 10+ lines in existing workflows)
- Installs ALL required Horde extensions automatically (25+ extensions)
- Covers extensions missing in existing workflows:
  - Graphics: gd, imagick
  - Utilities: xml, zip, soap, tidy, readline, bz2, xsl
  - Caching: apcu, memcached, redis, opcache
  - Optional: pgsql

The workflow follows the same testing pattern as php83.yml and
php84-alpha.yml but with significantly reduced maintenance burden.

Future enhancement: These workflows could be consolidated into a single
matrix-based workflow using the installation script.
@ralflang
Copy link
Member Author

Added: PHP 8.5 CI Workflow

I've added a new GitHub Actions workflow (php85.yml) that demonstrates the simplified approach enabled by the install-ubuntu-24.04.sh script.

Comparison: Before vs After

Old approach (php83.yml, php84-alpha.yml):

- name: Upgrade to PHP 8.4 from PPA
  run: |
    sudo add-apt-repository ppa:ondrej/php
    sudo apt -o Dpkg::Progress-Fancy=0 update
    sudo apt install php8.4 php8.4-dom php8.4-pdo php8.4-sqlite3 \
      php8.4-mysql php8.4-curl php8.4-intl php8.4-mbstring \
      php8.4-cli php8.4-fpm php8.4-ldap php8.4-bcmath
    sudo update-alternatives --set php /usr/bin/php8.4

New approach (php85.yml):

- 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

Benefits

  • One line installs PHP 8.3, 8.4, AND 8.5 with all extensions
  • 25+ extensions automatically included (vs ~8-10 in old workflows)
  • Missing extensions now covered: xml, zip, soap, gd, imagick, tidy, readline, bz2, xsl, apcu, memcached, redis, opcache, pgsql
  • Maintainable: Update one script instead of multiple workflow files
  • Tested: Script already verified working

Future Enhancement

The three PHP workflows (php83.yml, php84-alpha.yml, php85.yml) could be consolidated into a single matrix-based workflow:

strategy:
  matrix:
    php-version: ['8.3', '8.4', '8.5']
steps:
  - name: Install PHP
    run: sudo bash scripts/install-ubuntu-24.04.sh
  - name: Set version
    run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php-version }}

This would reduce maintenance from 3 workflow files to 1.

@ralflang ralflang merged commit 41b714e into FRAMEWORK_6_0 Feb 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant