Build PHP 8.3.2 for Windows Using GitHub Actions

This guide walks through forking the php-windows-builder repository, configuring a GitHub Actions workflow, running the pipeline to compile PHP 8.3.2 and extensions on Windows, and downloading and verifying the resulting binaries and extension packages.

Open Source Tech Hub
Open Source Tech Hub
Open Source Tech Hub
Build PHP 8.3.2 for Windows Using GitHub Actions

Fork the Official Repository

The official source is https://github.com/php/php-windows-builder. Clone or fork it to your own GitHub account, for example https://github.com/Tinywan/php-windows-builder, to create a personal actions workspace.

Pipeline Configuration

The default workflow file lives at .github/workflows/php.yml. Create a new workflow file (e.g., php8.3.2.yml) in your fork:

name: Build PHP 8.3.2
on:
  release:
    types: [published]
jobs:
  php:
    strategy:
      matrix:
        arch: x64
        ts: nts
    runs-on: windows-2019
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Build
        uses: ./php
        with:
          php-version: ${{ github.event.inputs.php-version }}
          arch: ${{ matrix.arch }}
          ts: ${{ matrix.ts }}
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Upload artifact to the release
        uses: php/php-windows-builder/release@v1
        with:
          release: 8.3.2
          token: ${{ secrets.PHP_TOKEN }}

PHP version: 8.3.2 Architecture: x64 Thread safety:

nts

Build PHP

Run the Pipeline

Environment Monitoring

Run actions/checkout@v4
  with:
    repository: Tinywan/php-windows-builder
    token: ***
    ssh-strict: true
    persist-credentials: true
    clean: true
    sparse-checkout-cone-mode: true
    fetch-depth: 1
    fetch-tags: false
    show-progress: true
    lfs: false
    submodules: false
    set-safe-directory: true
Syncing repository: Tinywan/php-windows-builder
... (git log output) ...

Actual Build

After the workflow finishes (it may take several minutes), the build completes.

Download the Built Package

Download URL:

https://github.com/Tinywan/php-windows-builder/actions/runs/8282409968

Extract the zip file php-8.3.2-nts-Win32-vs16-x64.zip to obtain the PHP binaries.

Verify PHP Version

$ ./php.exe -v
PHP 8.3.2 (cli) (built: Mar 14 2024 14:42:01) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.3.2, Copyright (c) Zend Technologies

Build PHP Extensions

name: Build PHP Extension
on:
  workflow_dispatch:
    inputs:
      extension_url:
        description: 'Extension URL'
        required: true
      extension_ref:
        description: 'Extension ref'
        required: true
jobs:
  get-extension-matrix:
    runs-on: ubuntu-latest
    outputs:
      matrix: ${{ steps.extension-matrix.outputs.matrix }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Get the extension matrix
        id: extension-matrix
        uses: ./extension-matrix
        with:
          extension-url: ${{ inputs.extension_url }}
          extension-ref: ${{ inputs.extension_ref }}
          arch-list: 'x64, x86'
          ts-list: 'nts, ts'
  extension:
    needs: get-extension-matrix
    runs-on: ${{ matrix.os }}
    strategy:
      matrix: ${{ fromJson(needs.get-extension-matrix.outputs.matrix) }}
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Build the extension
        uses: ./extension
        with:
          extension-url: ${{ inputs.extension_url }}
          extension-ref: ${{ inputs.extension_ref }}
          php-version: ${{ matrix.php-version }}
          arch: ${{ matrix.arch }}
          ts: ${{ matrix.ts }}
  artifacts:
    runs-on: ubuntu-latest
    needs: extension
    steps:
      - name: Upload artifacts
        uses: actions/upload-artifact/merge@v4
        with:
          name: artifacts
          delete-merged: true

Build Results

Download the generated extension artifact (e.g., Xdebug) and unzip.

Example file inside the zip: php_xdebug-3.3.1-8.1-nts-vs16-x64.zip contains php_xdebug.dll, ready for use.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

ci/cdbuildGitHub Actionsphp-extensions
Open Source Tech Hub
Written by

Open Source Tech Hub

Sharing cutting-edge internet technologies and practical AI resources.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.