Commit Graph

1066 Commits

Author SHA1 Message Date
henderkes
5bab8f50bb fix windows again 2026-03-08 01:11:28 +07:00
henderkes
dc9dd5f513 undefined references 2026-03-08 01:01:43 +07:00
henderkes
72633eff83 php 8.6 2026-03-08 00:57:32 +07:00
henderkes
e2b611379c fix on windows? 2026-03-06 18:23:52 +07:00
henderkes
1cbc658911 move script detection to C side, not Go side (because we only want to detect anything when HAVE_EMBED_CLI is false) 2026-03-06 18:08:34 +07:00
henderkes
82a62b0db9 executephpcode 2026-03-06 17:39:03 +07:00
henderkes
c40a2572be fix expected args for php-cli, though this won't help the strangely failing tests 2026-03-06 17:07:16 +07:00
henderkes
30ff796656 remove duplicate test 2026-03-06 17:00:03 +07:00
henderkes
0f28cc044b fix cli test 2026-03-06 16:45:06 +07:00
henderkes
9ca03588d4 update for new compilation in php-src 2026-03-06 16:38:31 +07:00
henderkes
4726593abc clang format 2026-03-06 15:19:14 +07:00
henderkes
ebda59dd89 Merge branch 'main' into refactor/php-cli
# Conflicts:
#	frankenphp.go
#	frankenphp_test.go
2026-03-06 15:08:37 +07:00
henderkes
a072fa1670 Merge branch 'main' into refactor/php-cli
# Conflicts:
#	frankenphp.c
#	frankenphp.go
2026-03-06 15:05:59 +07:00
Kévin Dunglas
5d44741041 ci: deploy docs when they change (#2234)
Signed-off-by: Kévin Dunglas <kevin@dunglas.fr>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-05 18:10:56 +01:00
Kévin Dunglas
73c7b2efd5 ci: use Powershell 7+ for Windows workflow (#2236) 2026-03-05 18:07:13 +01:00
Kévin Dunglas
6268015b3a ci: fallback on static-php.dev mirror when php.net is down (#2233)
Unfortunately, GitHub Actions is often blocked by the php.net CDN. This
patch adds a fallback to use GitHub to try to determine the PHP version
to use. This is less ideal because PHP currently doesn't use GitHub
extensively, and distribution archives aren't available in the GitHub
releases, only on php.net.
2026-03-05 17:50:21 +01:00
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