Skip to content

ServBay/PHP-Windows-Portable

Repository files navigation

PHP-Windows-Portable

Automated PHP compilation for Windows using GitHub Actions, built on PHP's official php-windows-builder.

Developed by ServBay Team

δΈ­ζ–‡ζ–‡ζ‘£ | Documentation

✨ Features

  • πŸš€ Based on PHP official build tool (php-windows-builder)
  • πŸ“¦ Support multiple PHP versions (stable/testing/development)
  • πŸ”§ Extension building and management
  • 🎯 Flexible version and extension configuration
  • πŸ” Thread-Safe and Non-Thread-Safe builds
  • 🌐 Complete GitHub Actions automation
  • βœ… Automated testing and packaging
  • πŸ“ Detailed build information and SHA256 checksums

🎯 Why Use This Project?

This project provides a zero-configuration way to build PHP for Windows:

  • βœ… No local environment setup needed - Everything runs on GitHub Actions
  • βœ… Official PHP build tools - Based on PHP's maintained builder
  • βœ… Extension support - Build popular extensions automatically
  • βœ… Complete testing - Runs official PHP tests
  • βœ… Automatic packaging - Creates release-ready artifacts

πŸš€ Quick Start

Step 1: Fork this Repository

Fork this repository to your GitHub account.

Step 2: Go to Actions Tab

Navigate to the Actions tab in your forked repository.

Step 3: Run the Workflow

  1. Select Build PHP for Windows workflow
  2. Click Run workflow
  3. Fill in the parameters (see examples below)
  4. Click Run workflow to start

πŸ“š Usage Examples

Example 1: Build Stable PHP with Default Extensions

Version Type: stable
Version Number: 8.4.14
Architecture: x64
Thread Safety: nts
Build Extensions: true
Custom Extensions JSON: (leave empty)
Create GitHub Release: true

Included extensions: xdebug, redis, apcu, imagick, memcache, memcached, mongodb, imap

Example 2: Build PHP with Custom Extensions

Version Type: stable
Version Number: 8.4.14
Architecture: x64
Thread Safety: nts
Build Extensions: true
Custom Extensions JSON: [{"name":"swoole","url":"https://github.com/swoole/swoole-src","ref":"5.1.5","args":"--enable-swoole","libs":"openssl nghttp2"}]
Create GitHub Release: true

Example 3: Build PHP 8.5 Testing Version

Version Type: testing
Testing Tag: php-8.5.0RC4
Architecture: x64
Thread Safety: nts
Build Extensions: true
Create GitHub Release: true

Example 4: Build PHP 8.6 Development Version

Version Type: development
Dev Commit Hash: 1cf63a93801e02d9f75dde59b849dcfa632b9237
Dev Version: 8.6.0-dev-20251105
Architecture: x64
Thread Safety: nts
Build Extensions: false
Create GitHub Release: true

πŸ“‹ Parameters Reference

Version Configuration

Parameter Description Example
Version Type stable/testing/development stable
Stable Version PHP stable version 8.4.14
Testing Tag GitHub tag name php-8.5.0RC4
Dev Commit Hash Git commit hash 1cf63a93...
Dev Version Custom version ID 8.6.0-dev-20251105

Build Configuration

Parameter Description Options
Architecture CPU architecture x64 / x86
Thread Safety Thread safety mode nts / ts

Recommendation: Use nts for better performance (for Nginx, IIS FastCGI)

Extension Configuration

Parameter Description Default
Build Extensions Build extensions true
Custom Extensions JSON Override defaults See below

Default Extensions (8 extensions)

  • xdebug 3.4.0 - Debugger
  • redis 6.1.0 - Redis client
  • apcu 5.1.24 - APCu cache
  • imagick 3.7.0 - Image processing
  • memcache 8.2 - Memcache client
  • memcached 3.3.0 - Memcached client
  • mongodb 1.20.1 - MongoDB driver
  • imap 1.0.2 - IMAP extension

Custom Extension JSON Format

[
  {
    "name": "extension-name",
    "url": "https://github.com/owner/repo",
    "ref": "tag-or-branch",
    "args": "--enable-extension",
    "libs": "dep1 dep2"
  }
]

See also:

Release Options

Parameter Description Default
Create GitHub Release Auto-create release true

πŸ“¦ Build Output

Artifacts (90-day retention)

  • php-{version}-{type}-{TS/NTS}-Win-{arch}.zip - PHP build
  • php-{version}-{type}-{TS/NTS}-Win-{arch}.sha256 - Checksum
  • extension-{name}-{version}-{arch}-{TS/NTS}/ - Extension builds

GitHub Release (Permanent)

Automatically creates release with:

  • Complete PHP package with all extensions
  • SHA256 checksum
  • BUILD_INFO.md (build information)

πŸ” SHA256 Verification

Windows PowerShell:

$hash = (Get-FileHash -Path "php-*.zip" -Algorithm SHA256).Hash
$expected = (Get-Content "php-*.sha256")
if ($hash -eq $expected) {
  Write-Host "βœ“ Verification passed"
} else {
  Write-Host "βœ— Verification failed"
}

Linux/macOS:

sha256sum -c php-*.sha256

πŸ“š Documentation

❓ FAQ

Q: Which build method should I use?

A: This project uses GitHub Actions (official builder) - the only recommended method.

Advantages:

  • βœ… Zero setup - No local environment needed
  • βœ… Reliable - Based on officially maintained tools
  • βœ… Complete - Native extension support
  • βœ… Fast - GitHub's high-performance environment

Q: NTS or TS?

A:

  • NTS (Non-Thread-Safe) - Recommended

    • For: Nginx + PHP-FPM, IIS FastCGI
    • Better performance
  • TS (Thread-Safe)

    • For: Apache mod_php
    • Supports multithreading

Q: How do I build specific extension versions?

A: Specify the ref field in extension JSON:

{
  "name": "xdebug",
  "url": "https://github.com/xdebug/xdebug",
  "ref": "3.4.0",
  "args": "--enable-xdebug"
}

Find extension versions on their GitHub releases/tags page.

Q: Build failed, what to do?

A: Troubleshooting steps:

  1. Check Actions logs for specific errors
  2. Verify PHP version/tag is correct
  3. Verify extension JSON format is valid
  4. Check extension compatibility with PHP version

Q: What extensions are supported?

A: All PECL and third-party extensions with source code. Popular ones:

  • Xdebug, Redis, Imagick, Swoole, MongoDB
  • PDO drivers, GD, ZIP, OpenSSL, cURL
  • More: EXTENSIONS_GUIDE.md

πŸ—οΈ Technical Architecture

Workflow Overview

User Input β†’ Prepare β†’ Build PHP β†’ Build Extensions β†’ Package β†’ Release
          (Parse)    (Official)  (Official)       (ZIP+SHA256) (GitHub)

Based on PHP Official Builder

Uses php-windows-builder:

  • Automatic dependency download
  • Automatic Visual Studio configuration
  • Built-in test runner
  • PGO optimization support

πŸ”— Related Resources

πŸ“„ License

This project uses the same license as PHP.

🀝 Contributing

Issues and Pull Requests are welcome!

Especially welcome:

  • Add more popular extension configurations
  • Improve documentation
  • Report bugs and issues

See: CONTRIBUTING.md

πŸ™ Acknowledgments

This project is developed and maintained by the ServBay Team.

Special thanks to:


πŸ’‘ Tip: This project is designed for GitHub Actions - simple, fast, and reliable!

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors