Skip to main content

Overview

Envloom provides comprehensive PHP runtime management with support for multiple versions, per-version configuration, PHP-FPM process management, and Composer integration. All PHP installations are managed locally in the bin/php/ directory with automatic version detection and update checking.

Version Management

Installing PHP Versions

Envloom downloads PHP releases from the official Windows PHP distribution and manages them by major.minor version lines.
1

Browse Available Versions

Navigate to the PHP page in the Envloom UI to see all available major.minor version lines (e.g., 8.3, 8.2, 8.1).
2

Install Latest Build

Click the install button next to any version line to download and install the latest build for that line.
3

Automatic Setup

Envloom automatically:
  • Downloads the Thread-Safe x64 build
  • Verifies SHA256 checksums when available
  • Extracts to bin/php/<version>/
  • Generates version-specific php.ini
  • Starts PHP-FPM on the assigned port

Version Detection

On startup, Envloom:
  • Scans bin/php/ for existing installations
  • Detects installed versions from directory names (e.g., 8.3, 8.2)
  • Validates that php.exe and php-cgi.exe exist
  • Automatically recovers from corrupted installations
PHP versions are cached from releases.json with a 1-hour TTL. Update checks run hourly in the background when autoUpdate is enabled.

Setting the Current Version

The “current” PHP version is used globally for CLI commands and new sites.
# Via CLI
loom php 8.3

# Via UI
# Select version in PHP page and click "Set as Current"
Envloom creates a junction at bin/php/current pointing to the active version, allowing the php.cmd shim to resolve automatically.

Uninstalling Versions

# Via CLI
loom php uninstall 8.2

# Via UI
# Click uninstall button next to installed version
Uninstalling a PHP version will stop its FPM process and remove the entire version directory. Sites using that version will fail until reassigned.

PHP-FPM Port Management

Port Assignment

Each PHP version runs on a unique port calculated from a configurable base port:
// Default base: 9000
// Port calculation: base + (major * 10) + minor
// Examples:
PHP 8.39083
PHP 8.29082
PHP 8.19081
PHP 7.49074

Configuring Base Port

Change the base port in the PHP settings page. All version ports recalculate automatically:
await setPhpBasePort(9100);
// PHP 8.3 → 9183
// PHP 8.2 → 9182

FPM Process Management

PHP-FPM processes are managed as php-cgi.exe instances:
Start-Process -WindowStyle Hidden `
  -FilePath "bin/php/8.3/php-cgi.exe" `
  -ArgumentList "-b","9083","-c","bin/php/8.3/php.ini"
FPM services auto-start on app launch if autoStartServices is enabled, and auto-stop on app exit.

PHP Configuration (php.ini)

Configuration Structure

Envloom uses a hierarchical configuration system:
  1. Base template (config/php/php.ini) - Global defaults
  2. Version overrides (config/php/<version>.ini) - Per-version customization
  3. Runtime logs - Automatically injected log paths

Managed Values

Envloom manages these values automatically in all php.ini files:
; --- Envloom managed values ---
upload_max_filesize = 128M
post_max_size = 128M
memory_limit = 256M
; --- /Envloom managed values ---
Change these via UI or API:
await setPhpIniValues("256", "512");
// maxUploadSizeMb, memoryLimitMb

Required Extensions

Envloom enforces required extensions for Laravel compatibility:
; --- Envloom required extensions ---
[PHP]
extension_dir = "ext"
extension=pdo_sqlite
extension=sqlite3
extension=pdo_mysql
extension=pdo_pgsql
extension=pdo_odbc
extension=zip
extension=openssl
extension=curl
extension=mbstring
extension=fileinfo
; --- /Envloom required extensions ---

Runtime Logging

Each PHP version logs errors to a dedicated file:
; --- Envloom runtime logging ---
log_errors = On
error_log = "logs/php/php-8_3.error.log"
; --- /Envloom runtime logging ---
Access logs from the Logs page or systray menu.

Editing php.ini

  1. Navigate to PHP page
  2. Click “Open php.ini” in systray or settings
  3. Edit config/php/php.ini
  4. Changes apply to all versions on next reload
  1. Edit config/php/<version>.ini (e.g., 8.3.ini)
  2. Add custom directives
  3. Reload Envloom or run loom reload

Composer Integration

Installation

Composer is automatically downloaded during bootstrap:
  • Downloaded to bin/composer/composer.phar
  • Shim created at bin/composer.cmd
  • Added to PATH automatically

Usage

# Global usage
composer create-project laravel/laravel my-app

# Uses current PHP version
php bin/composer/composer.phar install

# Version-specific
bin/php/8.3/php.exe bin/composer/composer.phar install

Laravel Installer

Envloom tracks and manages the Laravel Installer:
// Check status
const catalog = await getPhpCatalog();
console.log(catalog.laravelInstaller.installed); // true/false
console.log(catalog.laravelInstaller.version);   // "5.8.3"

// Install or update
await installOrUpdateLaravelInstaller();

CLI Commands

Version Switching

# Set current version
loom php 8.3

# List installed versions
loom list php

# Check current version
loom current

Shims

Envloom creates version-specific shims for direct access:
# Current version
php --version

# Specific version
php83 --version
php82 --version
php81 --version
Shims are automatically created at bin/php<major><minor>.cmd for all installed versions.

Site-Specific PHP Versions

Each site can use a different PHP version:
// Set PHP version for a site
await setSitePhpVersion(siteId, "8.2");

// Regenerates nginx config with correct FPM port
// Port: 9000 + (8 * 10) + 2 = 9082
The site’s nginx config automatically uses the correct fastcgi_pass port:
location ~ \.php$ {
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass 127.0.0.1:9082;  # PHP 8.2 FPM port
}

Update Checking

Envloom checks for PHP updates hourly (configurable via autoUpdate setting):
1

Cache Check

Fetches releases.json if cache is older than 1 hour
2

Version Comparison

Compares installed builds against latest available builds per line
3

Update Notification

Displays “Update” button in UI for outdated installations

Troubleshooting

FPM Not Starting

Check logs/php/php-<version>.error.log for startup errors:
# Via CLI
loom logs php 8.3

# Manual check
type logs\php\php-8_3.error.log
Common issues:
  • Port already in use
  • Missing extensions
  • Syntax errors in php.ini

Corrupted Installation

Envloom automatically detects corrupted installations on startup:
// Validation checks:
- php.exe exists
- php-cgi.exe exists
- php.ini is readable
- Directory structure is intact
Corrupted installations are removed automatically. Reinstall from the UI.

Port Conflicts

# Check if port is in use
netstat -ano | findstr :9083

# Change base port to avoid conflicts
# UI: PHP Settings > Base Port > 9100

API Reference

// Get catalog with all versions and config
const catalog = await getPhpCatalog();

// Install latest build for a line
await installLatestPhp("8.3");

// Set active version within a line
await setActivePhp("8.3", "8.3.14");

// Set current line globally
await setPhpCurrentLine("8.3");

// Update configuration
await setPhpIniValues("256", "512");
await setPhpBasePort(9100);

// Uninstall version
await uninstallPhpLine("8.2");
See src/features/runtimes/php-api.ts for complete TypeScript definitions.