Commit Graph

1043 Commits

Author SHA1 Message Date
Alexander Stecher
356d2e1745 refactor: cleaner cgi string handling
Introduces C-side interned string registry (frankenphp_strings) and a frankenphp_server_vars struct to bulk-register known $_SERVER variables with pre-sized hashtable capacity.
2026-03-04 17:20:24 +01:00
Kévin Dunglas
27ff6b49d8 docs: contributing on Windows (#2222)
Signed-off-by: Kévin Dunglas <kevin@dunglas.fr>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-03 20:40:05 +01:00
Kévin Dunglas
db41496a9f chore: make go_ub_write() length parameter type consistent with C 2026-03-03 16:46:26 +01:00
Philippe DELENTE
8151c3a7f3 feat: add Spanish translation (#2096) 2026-03-03 11:41:21 +01:00
Kévin Dunglas
cda58d224b fix(windows): ensure DLLs can always be located by PHP (#2227)
Prevent crashes when `php.ini` references PHP extensions using relative
paths, and FrankenPHP is started from a different working directory than
the one containing extensions, or with `caddy start` (instead of `caddy
run`).

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 18:27:30 +01:00
Kévin Dunglas
c2b8c8b15d feat: install script for Windows (#2228)
Update the shell script and add a PowerShell script to install the
Windows binary.

---------

Co-authored-by: Kévin Dunglas <kevin@dunglas.dev>
2026-03-02 15:31:54 +01:00
Alexander Stecher
dcfdb2f068 docs: hardened image with Caddy environment vars (#2229)
Adds `XDG_CONFIG_HOME` and `XDG_DATA_HOME` to the example hardened image
docs, otherwise Caddy will fail to use the nonexistent /home directory
instead of `/data/caddy` and `/config/caddy`.

Also removes an unnecessary `--chown=nonroot:nonroot`.
2026-03-02 08:46:59 +01:00
Alexander Stecher
8f4412cbbf perf: move sandboxed environment to the C side (#2058)
This PR uses `zend_array_dup` to simplify and optimize the environment sandboxing
logic. It also guarantees no environment leakage on FrankenPHP restarts.
2026-02-26 22:34:54 +01:00
Kévin Dunglas
25ed020036 feat: Windows support (#2119)
Closes #83 #880 #1286.

Working patch for Windows support.

Supports linking to the [official PHP release (TS
version)](https://www.php.net/downloads.php).
Includes some work from #1286 (thanks @TenHian!!)

This patch allows using Visual Studio to compile the cgo code. To do so,
it must be compiled with Go 1.26 (RC) with the following setup:

```powershell
winget install -e --id Microsoft.VisualStudio.2022.Community --override "--passive --wait --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.Llvm.Clang --includeRecommended"
winget install -e --id GoLang.Go

$env:PATH += ';C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\bin'

cd c:\
gh repo clone microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat
.\vcpkg\vcpkg install pthreads brotli

# build watcher
Invoke-WebRequest -Uri "https://github.com/e-dant/watcher/releases/download/0.14.3/x86_64-pc-windows-msvc.tar" -OutFile "$env:TEMP\watcher.tar"
tar -xf "$env:TEMP\watcher.tar" -C C:\
Rename-Item -Path "C:\x86_64-pc-windows-msvc" -NewName "watcher-x86_64-pc-windows-msvc"
Remove-Item "$env:TEMP\watcher.tar"

# download php
Invoke-WebRequest -Uri "https://downloads.php.net/~windows/releases/archives/php-8.5.1-Win32-vs17-x64.zip" -OutFile "$env:TEMP\php.zip"
Expand-Archive -Path "$env:TEMP\php.zip" -DestinationPath "C:\"
Remove-Item "$env:TEMP\php.zip"

# download php development package
Invoke-WebRequest -Uri "https://downloads.php.net/~windows/releases/archives/php-devel-pack-8.5.1-Win32-vs17-x64.zip" -OutFile "$env:TEMP\php-devel.zip"
Expand-Archive -Path "$env:TEMP\php-devel.zip" -DestinationPath "C:\"
Remove-Item "$env:TEMP\php-devel.zip"

$env:GOTOOLCHAIN = 'go1.26rc1'
$env:CC = 'clang'
$env:CXX = 'clang++'
$env:CGO_CFLAGS = "-I$env:C:\vcpkg\installed\x64-windows\include -IC:\watcher-x86_64-pc-windows-msvc -IC:\php-8.5.1-devel-vs17-x64\include -IC:\php-8.5.1-devel-vs17-x64\include\main -IC:\php-8.5.1-devel-vs17-x64\include\TSRM -IC:\php-8.5.1-devel-vs17-x64\include\Zend -IC:\php-8.5.1-devel-vs17-x64\include\ext"
$env:CGO_LDFLAGS = '-LC:\vcpkg\installed\x64-windows\lib -lbrotlienc -LC:\watcher-x86_64-pc-windows-msvc -llibwatcher-c -LC:\php-8.5.1-Win32-vs17-x64 -LC:\php-8.5.1-devel-vs17-x64\lib -lphp8ts -lphp8embed'

# clone frankenphp and build
git clone -b windows https://github.com/php/frankenphp.git
cd frankenphp\caddy\frankenphp
go build -ldflags '-extldflags="-fuse-ld=lld"' -tags nowatcher,nobadger,nomysql,nopgx

# Tests

$env:PATH += ";$env:VCPKG_ROOT\installed\x64-windows\bin;C:\watcher-x86_64-pc-windows-msvc";C:\php-8.5.1-Win32-vs17-x64"
"opcache.enable=0`r`nopcache.enable_cli=0" | Out-File -Encoding ascii php.ini
$env:PHPRC = Get-Location
go test -ldflags '-extldflags="-fuse-ld=lld"' -tags nowatcher,nobadger,nomysql,nopgx .
```

TODO:

- [x] Fix remaining skipped tests (scaling and watcher)
- [x] Test if the watcher mode works as expected
- [x] Automate the build with GitHub Actions

---------

Signed-off-by: Marc <m@pyc.ac>
Co-authored-by: Kévin Dunglas <kevin@dunglas.dev>
Co-authored-by: DubbleClick <m@pyc.ac>
2026-02-26 12:38:14 +01:00
Kévin Dunglas
0ae33863d0 chore: use ldflags to set Server header 2026-02-24 13:28:52 +01:00
Kévin Dunglas
bf30297104 chore: prepare release 1.11.3 caddy/v1.11.3 v1.11.3 2026-02-23 16:47:48 +01:00
Kévin Dunglas
f434f5ea37 chore: bump deps 2026-02-23 16:46:51 +01:00
Kévin Dunglas
681aae60a6 fix(worker): revert ini reset, keep session fixes (#2139)
Revert the INI snapshot/restore mechanism from #2139 which caused
issues with frameworks that lazily set ini values like session.save_path
(#2185). Replace the session handler snapshot/restore with a simpler
direct session state reset from #2193, which preserves mod_user_names
across requests without requiring session module reload.

Co-Authored-By: Xavier Leune <xavier.leune@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 14:02:20 +01:00
Kévin Dunglas
036aa2b5a1 fix: work around GCC 12 false positive when building watcher on i386
GCC 12 on Debian Bookworm i386 emits a spurious -Werror=use-after-free
in libstdc++ basic_string.h when compiling e-dant/watcher, causing
Docker builds to fail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 12:59:53 +01:00
tehmaestro
c99b6db5ae fix: nomercure build tag (#2212)
- Fixes nomercure tag build
- Conditionally addds the mercure route and mercure project import

Fixes https://github.com/php/frankenphp/issues/2209

I am by no means a go developer, feel free to use this or not :)

---------

Signed-off-by: tehmaestro <alexnegrila89@gmail.com>
Co-authored-by: Alexander Stecher <45872305+AlliBalliBaba@users.noreply.github.com>
2026-02-22 18:46:39 +01:00
YL
0dd485c0f2 docs: document the extensionworkers api (#2055) 2026-02-22 12:45:09 +01:00
Rob Landers
6d86ea84bc chore: run go fmt (#2211)
A few files were not formatted correctly.

Signed-off-by: Robert Landers <landers.robert@gmail.com>
Co-authored-by: Marc <m@pyc.ac>
2026-02-21 17:38:51 +01:00
Rob Landers
755db86116 metrics: only report workers ready when actually ready (#2210)
In #2205 it appears that workers could be reported in metrics as "ready"
before they are actually ready. This changes the reporting so that
workers are only reported ready once they have completed booting.

Signed-off-by: Robert Landers <landers.robert@gmail.com>
2026-02-21 17:34:35 +01:00
Marc
2bdf85866c Upgrade to Cady v2.11.1 (#2214)
fixes failing integration tests and closes
https://github.com/php/frankenphp/issues/2213
2026-02-21 23:29:47 +07:00
Marc
f38834826c Update static binary PHP version to 8.5 (#2168)
Signed-off-by: Marc <m@pyc.ac>
2026-02-20 21:16:21 +07:00
Alexander Stecher
b02d99ae8a feat: always ignore user abort (#2189)
Automatically sets `ignore_user_abort` to true in worker mode as
mentioned in #2186, removing the requirement to change it via ini.

Would also be possible to expose something like an explicit
`frankenphp_client_has_closed()` function for in-between critical
sections.

---------

Co-authored-by: Marc <m@pyc.ac>
2026-02-19 11:55:39 +01:00
Kévin Dunglas
7c563d2567 chore: minor cleanup in Caddy module tests (#2202) 2026-02-19 10:15:45 +01:00
Kévin Dunglas
bb3f7308f2 feat: allow to customize EmbeddedAppPath 2026-02-18 16:30:18 +01:00
Kévin Dunglas
151ea1c87d test(caddy): fix flaky tests on macOS 2026-02-18 16:29:36 +01:00
Kévin Dunglas
abba64b0ff chore: fix golangci-lint 2026-02-18 14:27:45 +01:00
Marc
0febfae509 fix relative embed paths early enough (#2199)
fix #1164
2026-02-18 07:54:48 +07:00
Kévin Dunglas
832b3b585e ci: fix static builds 2026-02-16 18:24:21 +01:00
Marc
f068912dee Add restart policies to frankenphp service (#2191)
interestingly Caddy doesn't have restart policies defined - we can't
afford this as php may segfault

---------

Signed-off-by: Marc <m@pyc.ac>
2026-02-16 14:45:49 +01:00
Kévin Dunglas
86539ffe34 ci: fix Docker builds 2026-02-16 13:25:30 +01:00
Kévin Dunglas
3aa71fd428 chore: prepare release 1.11.2 caddy/v1.11.2 v1.11.2 2026-02-12 10:58:02 +01:00
Kévin Dunglas
e2062af083 chore: cs improvements 2026-02-11 15:49:39 +01:00
Kévin Dunglas
82d6696c9d fix: race condition in thread shutdown during drain 2026-02-11 15:36:41 +01:00
Kévin Dunglas
49d738012a chore(caddy): modernize for Go 1.26 (#2183) 2026-02-11 15:36:18 +01:00
Kévin Dunglas
040ce55e17 perf: various optimizations (#2175) 2026-02-11 15:21:55 +01:00
Alexandre Daubois
d704e60bb0 chore: bump to Go 1.26 (#2178)
Bump and free perf boost with Green tea GC 🍵
2026-02-11 14:55:57 +01:00
Kévin Dunglas
471c5af2df fix: race condition introduced in 04fdc0c (#2180)
Fix issue introduced in 04fdc0c1e8
2026-02-11 13:07:09 +01:00
Xavier Leune
24d6c991a7 fix(worker): session leak between requests 2026-02-11 12:12:52 +01:00
Kévin Dunglas
04fdc0c1e8 fix: path confusion via unicode casing in CGI path splitting 2026-02-11 11:59:16 +01:00
Alexander Stecher
711d03256e docs: performance updates (#2173)
Some updates to the performance docs. Mainly creating this PR to test the automatic translations.
2026-02-10 11:12:15 +01:00
Kévin Dunglas
6eef0d30aa chore: bump deps 2026-02-09 14:31:16 +01:00
Kévin Dunglas
c30fef09d3 fix: ensure $SERVER["PHP_SELF"] always starts with a slash (#2172)
Closes #2166.
2026-02-09 13:51:55 +01:00
Alexander Stecher
46fa426c0d fix: translations (#2171)
Fixes translations in case of trailing slashes in the input
see https://github.com/php/frankenphp/actions/runs/21746819419
2026-02-08 21:09:13 +01:00
Marc
bcbd22a698 attempt to fix create-pr action from translation CI (#2169)
https://github.com/php/frankenphp/actions/runs/21746819419

Signed-off-by: Marc <m@pyc.ac>
2026-02-07 20:08:58 +01:00
Marc
e3da54d15f Add apk repository, update debian repository instructions (#2099)
closes https://github.com/php/frankenphp/pull/1753
closes https://github.com/php/frankenphp/issues/2156

As per discussion here
https://github.com/php/frankenphp/discussions/2060#discussioncomment-15299936
I went ahead with different repos for different php versions. Versioned
support with stuff like `apt install frankenphp8.5` or `apk add
frankenphp85` are technically also ready, but I'm not running any CI for
that yet. I don't think it's worth it at this point as it would double
the amount of runs.

The old debian repository with only 8.4 is deprecated but will receive
updates for a few more months.
Every update/installation will print this notice, though, which will
hopefully make everyone aware:

```console
# running update from 8.4.15...
Unpacking php-zts-cli (8.4.16-1) ...
Setting up php-zts-cli (8.4.16-1) ...

================================================================================
                          ⚠️  DEPRECATION NOTICE
================================================================================

The single-version php-zts repository is deprecated and will no longer receive updates.

Please migrate to the new repository with different PHP versions available.

More information: https://pkgs.henderkes.com

================================================================================
```

Updated the installer to version 8.5.
2026-02-06 11:11:58 +01:00
Alexandre Daubois
fba79a6ac8 feat(extgen): make the generator idempotent and avoid touching the original source (#2011) 2026-02-05 12:50:28 +01:00
Kévin Dunglas
db59edb590 ci: fix shellcheck errors and improve consistency (#2165) 2026-02-05 12:48:25 +01:00
Kévin Dunglas
3f2ed374c8 ci: disable Docker cache when building prod images 2026-02-04 17:50:11 +01:00
Tim Nelles
be2d6b96eb Merge commit from fork
Compute base-image fingerprint from bake metadata and store it under a vendor label. Add a local test script to reproduce the fingerprint and compare runs.

Co-authored-by: Tim Nelles <tim.nelles@denkwerk.com>
2026-02-04 13:09:44 +01:00
Xavier Leune
ad7e4f146d fix(worker): reset ini settinfs and session if changed during worker request 2026-02-03 16:27:35 +01:00
Kévin Dunglas
0f410a2e37 docs: remove outdated build tags 2026-02-03 14:52:16 +01:00