上一章节大概介绍了一下 是什么?了解更多请点击一下链接查看。这篇着重强调一下怎么正确使用。
PHP官方Windows构建工具php-windows-builder 1.0.0 发布
Fork 官方仓库
官方仓库地址:https://github.com/php/php-windows-builder
流水线配置
官方默认配置位于你的Github项目仓库
.github/workflows/php.yml
,这里我们直接新建一个 https://github.com/Tinywan/php-windows-builder/actions
php8.3.2.yml
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
运行流水线
环境监测
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
Getting Git version info
Temporarily overriding HOME='D:a_tempf932e9ec-2aae-4f93-a890-821934d7acaa' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
"C:Program FilesGitbingit.exe" config --global --add safe.directory D:aphp-windows-builderphp-windows-builder
Deleting the contents of 'D:aphp-windows-builderphp-windows-builder'
Initializing the repository
Disabling automatic garbage collection
Setting up auth
Fetching the repository
Determining the checkout info
Checking out the ref
"C:Program FilesGitbingit.exe" log -1 --format='%H'
'120c092ef7c71be9ecca3a5f79c2ae5d659ca0d0'
正式构建
这里比较漫长,请耐心等待哦!
终于构建结束啦!
下载构建好的包
下载地址:
https://github.com/Tinywan/php-windows-builder/actions/runs/8282409968
解压:
php-8.3.2-nts-Win32-vs16-x64.zip
查看PHP版本
$ ./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
查看PHP扩展
构建PHP扩展
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
构建结果
点击下载
artifacts
构建好的扩展包Xdebug
,解压后
随便解压一个
php_xdebug-3.3.1-8.1-nts-vs16-x64.zip
看看,你想要的php_xdebug.dll
就已经在里面啦!
原文始发于微信公众号(开源技术小栈):使用PHP-Windows-Builder 构建PHP和扩展入门指南
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/247641.html