Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3c035ae
Merge branch 'master' of github.com:seanmorris/php-wasm
seanmorris Dec 31, 2025
612afe0
iphone bugfix
seanmorris Jan 2, 2026
3e001e1
Tweaks
seanmorris Jan 3, 2026
a2b7b71
Clearing extra files from repo
seanmorris Jan 3, 2026
3959f33
Merge branch 'sm-iphone-demo-bug' into develop
seanmorris Jan 3, 2026
b4ba762
Tweak
seanmorris Jan 3, 2026
3fd3b8e
Extension toggle & mobile tweaks for demo-web app (#93)
seanmorris Jan 3, 2026
e75afdc
Merge branch 'develop' of github.com:seanmorris/php-wasm into develop
seanmorris Jan 3, 2026
f5203ae
Adding INACTIVE indicator for libxml (#95)
seanmorris Jan 3, 2026
d15d506
Adding waitline to CI (#94)
seanmorris Jan 3, 2026
31d6b93
Merge branch 'develop' of github.com:seanmorris/php-wasm into develop
seanmorris Jan 3, 2026
1249d99
Bugfix for shared build test & removing extraneous debug statement.
seanmorris Jan 3, 2026
e28a57e
Apply maximum brotli & gzip compression to .wasm & .so files before p…
seanmorris Jan 3, 2026
bcab874
Serve compressed assets from cloudflare when available
seanmorris Jan 4, 2026
c86acfa
Workflow tweaks
seanmorris Jan 4, 2026
cef7052
Content type correction
seanmorris Jan 4, 2026
589f970
Deploy pages function quickly
seanmorris Jan 4, 2026
8594406
Path tweaks
seanmorris Jan 4, 2026
ae9aa7f
Function tweak
seanmorris Jan 4, 2026
443032d
Function tweak
seanmorris Jan 4, 2026
77304b5
Adding "Cache-Control: no-transform" header
seanmorris Jan 4, 2026
2b4915d
Using encodeBody option in CF Function
seanmorris Jan 4, 2026
309434d
Pre-compress .dat files too
seanmorris Jan 4, 2026
a6a87f0
Suppress attempt to load libxml when it hasn't been provided in share…
seanmorris Jan 4, 2026
bd8b6f8
Adding version & variant options to php-tags.mjs
seanmorris Jan 4, 2026
c2c24d0
Adding cgi-node test & tweaking existing test
seanmorris Jan 5, 2026
dd1ce8e
Testing tweaks
seanmorris Jan 5, 2026
693b497
Test tweaks
seanmorris Jan 5, 2026
fd5fc18
Test tweaks
seanmorris Jan 5, 2026
606133d
Test tweaks
seanmorris Jan 5, 2026
e563c2c
Test tweaks
seanmorris Jan 5, 2026
23726be
Patching phpdbg in 8.2 & 8.4
seanmorris Jan 5, 2026
0a8c5a0
phpdbg updates
seanmorris Jan 8, 2026
3fd762c
Using a weak symbol and a runtime switch instead of macros
seanmorris Jan 8, 2026
15b648f
Allow version switching in phpdbg demo
seanmorris Jan 8, 2026
b00348e
node-cgi-test bugfix for static & shared builds
seanmorris Jan 9, 2026
b55215b
Backtraces & 8.1 in dbg preview
seanmorris Jan 10, 2026
b181e74
Version selector tweak
seanmorris Jan 10, 2026
eacbe64
Switching frames in phpdbg preview demo
seanmorris Jan 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 39 additions & 8 deletions .cloudflare/pages/functions/[[path]].js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,43 @@ export const onRequest = async (context) => {
return new Response("Not found", { status: 404 });
}

// return new Response(JSON.stringify({key, exists: !isMissing(obj), obj}));

return new Response(obj.body, {
headers: {
"Content-Type": obj.httpMetadata?.contentType || "application/octet-stream",
"Access-Control-Allow-Origin": "*",
},
});
// Preserve original content-type for use after negotiating compression
const originalContentType = obj.httpMetadata?.contentType || "application/octet-stream";

// Negotiate pre-compressed variants: Brotli preferred, then gzip
const acceptEncoding = context.request.headers.get("Accept-Encoding") || "";
let encoding;

if (acceptEncoding.includes("br")) {
const brKey = key + ".br";
const brObj = await context.env.NIGHTLY_BUILDS.get(brKey);
if (!isMissing(brObj)) {
obj = brObj;
encoding = "br";
}
}

// Fallback to gzip if supported
if (!encoding && acceptEncoding.includes("gzip")) {
const gzKey = key + ".gz";
const gzObj = await context.env.NIGHTLY_BUILDS.get(gzKey);
if (!isMissing(gzObj)) {
obj = gzObj;
encoding = "gzip";
}
}

console.log({originalContentType, encoding});

const headers = {
"Content-Type": originalContentType,
"Access-Control-Allow-Origin": "*",
};
if (encoding) {
headers["Content-Encoding"] = encoding;
headers["Cache-Control"] = "no-transform";
headers["Vary"] = "Accept-Encoding";
}

return new Response(obj.body, { headers, encodeBody: "manual" });
};
1 change: 1 addition & 0 deletions .github/.env_8.0.dynamic.ci
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ ASSERTIONS=0
OPTIMIZE=3
SYMBOLS=0

WITH_WAITLINE=1
WITH_PDO_PGLITE=0
WITH_VRZNO=0
1 change: 1 addition & 0 deletions .github/.env_8.0.shared.ci
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ WITH_ONIGURUMA=shared
WITH_OPENSSL=shared
WITH_INTL=shared

WITH_WAITLINE=1
WITH_PDO_PGLITE=0
WITH_VRZNO=0
1 change: 1 addition & 0 deletions .github/.env_8.0.static.ci
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,6 @@ WITH_ONIGURUMA=static
WITH_OPENSSL=1
WITH_INTL=static

WITH_WAITLINE=1
WITH_PDO_PGLITE=0
WITH_VRZNO=0
2 changes: 2 additions & 0 deletions .github/.env_8.1.dynamic.ci
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ WITH_SOURCEMAPS=0
ASSERTIONS=0
OPTIMIZE=3
SYMBOLS=0

WITH_WAITLINE=1
2 changes: 2 additions & 0 deletions .github/.env_8.1.shared.ci
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ WITH_MBSTRING=static
WITH_ONIGURUMA=shared
WITH_OPENSSL=shared
WITH_INTL=shared

WITH_WAITLINE=1
2 changes: 2 additions & 0 deletions .github/.env_8.1.static.ci
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ WITH_MBSTRING=static
WITH_ONIGURUMA=static
WITH_OPENSSL=1
WITH_INTL=static

WITH_WAITLINE=1
2 changes: 2 additions & 0 deletions .github/.env_8.2.dynamic.ci
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ WITH_SOURCEMAPS=0
ASSERTIONS=0
OPTIMIZE=3
SYMBOLS=0

WITH_WAITLINE=1
2 changes: 2 additions & 0 deletions .github/.env_8.2.shared.ci
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ WITH_MBSTRING=static
WITH_ONIGURUMA=shared
WITH_OPENSSL=shared
WITH_INTL=shared

WITH_WAITLINE=1
2 changes: 2 additions & 0 deletions .github/.env_8.2.static.ci
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ WITH_MBSTRING=static
WITH_ONIGURUMA=static
WITH_OPENSSL=1
WITH_INTL=static

WITH_WAITLINE=1
2 changes: 2 additions & 0 deletions .github/.env_8.3.dynamic.ci
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ WITH_SOURCEMAPS=0
ASSERTIONS=0
OPTIMIZE=3
SYMBOLS=0

WITH_WAITLINE=1
2 changes: 2 additions & 0 deletions .github/.env_8.3.shared.ci
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ WITH_MBSTRING=static
WITH_ONIGURUMA=shared
WITH_OPENSSL=shared
WITH_INTL=shared

WITH_WAITLINE=1
2 changes: 1 addition & 1 deletion .github/.env_8.3.static.ci
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ WITH_ONIGURUMA=static
WITH_OPENSSL=1
WITH_INTL=static


WITH_WAITLINE=1
2 changes: 2 additions & 0 deletions .github/.env_8.4.dynamic.ci
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ WITH_SOURCEMAPS=0
ASSERTIONS=0
OPTIMIZE=3
SYMBOLS=0

WITH_WAITLINE=1
2 changes: 2 additions & 0 deletions .github/.env_8.4.shared.ci
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ WITH_MBSTRING=static
WITH_ONIGURUMA=shared
WITH_OPENSSL=shared
WITH_INTL=shared

WITH_WAITLINE=1
2 changes: 2 additions & 0 deletions .github/.env_8.4.static.ci
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ WITH_MBSTRING=static
WITH_ONIGURUMA=static
WITH_OPENSSL=1
WITH_INTL=static

WITH_WAITLINE=1
22 changes: 18 additions & 4 deletions .github/bin/index-dirs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ TREE_FLAGS='-FCL 1'
cd ${PACKAGES_DIR};

find . -type d | while read DIR; do {
[[ "${DIR::-1}" == "pdo-cfd1" ]] && continue;
[[ "${DIR::-1}" == "pdo-pglite" ]] && continue;
[[ "${DIR::-1}" == "vrzno" ]] && continue;
[[ "${DIR::-1}" == "waitline" ]] && continue;
[[ "${DIR:2}" == "pdo-cfd1" ]] && continue;
[[ "${DIR:2}" == "pdo-pglite" ]] && continue;
[[ "${DIR:2}" == "vrzno" ]] && continue;
[[ "${DIR:2}" == "waitline" ]] && continue;

test -d ${DIR} || continue;
pushd ${DIR} > /dev/null;
Expand All @@ -21,6 +21,20 @@ find . -type d | while read DIR; do {
perl -pi -e "s#^</head>#<style> html { background-color: black; } body { filter: invert(1); } </style></head>#" index.html
perl -pi -e "s#^</p>#at $(date)</p>#" index.html
perl -pi -e "s#\t</p>#\t<br /><br />php-wasm © 2021-$(date +%Y) Sean Morris</p>#" index.html
shopt -s nullglob
for BINARY in *.wasm; do
brotli -kfZ ${BINARY}
gzip -k9 ${BINARY}
done;
for BINARY in *.so; do
brotli -kfZ ${BINARY}
gzip -k9 ${BINARY}
done;
for DAT in *.dat; do
brotli -kfZ ${DAT}
gzip -k9 ${DAT}
done;
shopt -u nullglob
popd > /dev/null;
}; done;

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-step.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ jobs:
- name: Build PHP for Web & PHP-CGI for Worker
run: time make --debug=basic web-mjs worker-cgi-mjs

- name: Build PHP CGI for Node
run: time make --debug=basic node-cgi-mjs

- name: Build php${{ inputs.phpVersion }}-sdl.so
run: time make --debug=basic packages/sdl/php${{ inputs.phpVersion }}-sdl.so packages/sdl/libGL.so PHP_VERSION=${{ inputs.phpVersion }}

Expand Down
110 changes: 102 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Build Artifacts

on: [push]
on:
push:
paths-ignore:
- '.cloudflare/pages/functions/\[\[path\]\].js'

permissions:
contents: read
Expand Down Expand Up @@ -253,12 +256,54 @@ jobs:



test-cgi-node-dynamic:
name: Test CGI Node ${{ matrix.phpVersion }} w/${{ matrix.libType }} libs
needs: [build-php-dynamic]
strategy:
matrix:
phpVersion: ['8.4', '8.3', '8.2', '8.1', '8.0']
libType: ['dynamic']
uses: ./.github/workflows/test-cgi-node-step.yaml
with:
artifactPattern: php-uncompressed-*-${{ matrix.libType }}
phpVersion: ${{ matrix.phpVersion }}
libType: ${{ matrix.libType }}

test-cgi-node-shared:
name: Test CGI Node ${{ matrix.phpVersion }} w/${{ matrix.libType }} libs
needs: [build-php-shared]
strategy:
matrix:
phpVersion: ['8.4', '8.3', '8.2', '8.1', '8.0']
libType: ['shared']
uses: ./.github/workflows/test-cgi-node-step.yaml
with:
artifactPattern: php-uncompressed-*-${{ matrix.libType }}
phpVersion: ${{ matrix.phpVersion }}
libType: ${{ matrix.libType }}

test-cgi-node-static:
name: Test CGI Node ${{ matrix.phpVersion }} w/${{ matrix.libType }} libs
needs: [build-php-static]
strategy:
matrix:
phpVersion: ['8.4', '8.3', '8.2', '8.1', '8.0']
libType: ['static']
uses: ./.github/workflows/test-cgi-node-step.yaml
with:
artifactPattern: php-uncompressed-*-${{ matrix.libType }}
phpVersion: ${{ matrix.phpVersion }}
libType: ${{ matrix.libType }}



compress-dynamic-packages:
name: Compress PHP w/${{ matrix.libType }} libs
runs-on: ubuntu-latest
needs:
- test-node-dynamic
- test-browser-dynamic
- test-cgi-node-dynamic
strategy:
matrix:
libType: ['dynamic']
Expand Down Expand Up @@ -324,6 +369,7 @@ jobs:
needs:
- test-node-shared
- test-browser-shared
- test-cgi-node-shared
strategy:
matrix:
libType: ['shared']
Expand Down Expand Up @@ -389,6 +435,7 @@ jobs:
needs:
- test-node-static
- test-browser-static
- test-cgi-node-static
strategy:
matrix:
libType: ['static']
Expand Down Expand Up @@ -539,12 +586,55 @@ jobs:



test-cgi-node-dynamic-compressed:
name: Test CGI Node ${{ matrix.phpVersion }} w/${{ matrix.libType }} libs (compressed)
needs: [compress-dynamic-packages]
strategy:
matrix:
phpVersion: ['8.4', '8.3', '8.2', '8.1', '8.0']
libType: ['dynamic']
uses: ./.github/workflows/test-cgi-node-step.yaml
with:
artifactPattern: php-compressed-${{ matrix.libType }}
phpVersion: ${{ matrix.phpVersion }}
libType: ${{ matrix.libType }}

test-cgi-node-shared-compressed:
name: Test CGI Node ${{ matrix.phpVersion }} w/${{ matrix.libType }} libs (compressed)
needs: [compress-shared-packages]
strategy:
matrix:
phpVersion: ['8.4', '8.3', '8.2', '8.1', '8.0']
libType: ['shared']
uses: ./.github/workflows/test-cgi-node-step.yaml
with:
artifactPattern: php-compressed-${{ matrix.libType }}
phpVersion: ${{ matrix.phpVersion }}
libType: ${{ matrix.libType }}

test-cgi-node-static-compressed:
name: Test CGI Node ${{ matrix.phpVersion }} w/${{ matrix.libType }} libs (compressed)
needs: [compress-static-packages]
strategy:
matrix:
phpVersion: ['8.4', '8.3', '8.2', '8.1', '8.0']
libType: ['static']
uses: ./.github/workflows/test-cgi-node-step.yaml
with:
artifactPattern: php-compressed-${{ matrix.libType }}
phpVersion: ${{ matrix.phpVersion }}
libType: ${{ matrix.libType }}



index-packages:
name: Create HTML Indexes
name: Post nightly build to Cloudflare
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
needs:
- test-browser-dynamic-compressed
- test-node-dynamic-compressed
- test-cgi-node-dynamic-compressed
steps:
- name: Check out repository code
uses: actions/checkout@v4
Expand All @@ -567,6 +657,9 @@ jobs:
tar -xzf ${TAR}
done;

- name: Install Brotli & GZip
run: sudo apt install brotli gzip

- name: Index Package Directories
run: ./.github/bin/index-dirs.sh packages/

Expand Down Expand Up @@ -601,9 +694,9 @@ jobs:
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
r2-bucket: ${{ secrets.R2_BUCKET }}
source-dir: packages
destination-dir: ${{ env.STAMP }}-${{ env.SHORT_SHA }}/
r2-bucket: php-wasm
source-dir: packages

- name: Install Wrangler
run: npm install -g wrangler
Expand All @@ -620,12 +713,13 @@ jobs:
if: ${{ success() }}
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d "{\"content\": \"New nightly build available: https://nightly.php-wasm.seanmorr.is/${{ env.STAMP }}-${{ env.SHORT_SHA }}/\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}
-X POST \
-d "{\"content\": \"New nightly build available: https://nightly.php-wasm.seanmorr.is/${{ env.STAMP }}-${{ env.SHORT_SHA }}/\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}

build-demo:
name: Build Web Demo
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
needs:
- index-packages
Expand Down Expand Up @@ -696,10 +790,10 @@ jobs:

deploy-docs:
name: Deploy Docs to GitHub Pages
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
needs:
- build-demo
if: github.ref == 'refs/heads/master'
permissions:
contents: read
pages: write
Expand Down
Loading