Skip to content

Commit 164bc4d

Browse files
authored
docs: deploying on Windows (#2500)
FrankenPHP runs natively on Windows since v1.12 (#2119), but the docs don't mention it as a deployment target. This adds a "Deploying on Windows" section to the production guide (install, running as a Windows service with WinSW as [recommended by the Caddy docs](https://caddyserver.com/docs/running#windows-service), graceful reload) and a pointer to the Windows compilation instructions in the compile docs. Related to #2442. Follow-ups: #2501 (static/embed, see also #2503), #2502 (macOS).
1 parent 51ca6e4 commit 164bc4d

2 files changed

Lines changed: 52 additions & 3 deletions

File tree

docs/compile.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Compile FrankenPHP from sources with libphp.so
3-
description: Build FrankenPHP from source on Linux, macOS and FreeBSD, linking PHP as a shared library via xcaddy or go build, and add custom Caddy modules and extensions.
3+
description: Build FrankenPHP from source on Linux, macOS, FreeBSD and Windows, linking PHP as a shared library via xcaddy or go build, and add custom Caddy modules and extensions.
44
---
55

66
# Compile from sources
@@ -10,6 +10,10 @@ This is the recommended method.
1010

1111
Alternatively, [fully and mostly static builds](static.md) can also be created.
1212

13+
> [!NOTE]
14+
>
15+
> To compile FrankenPHP on Windows, follow [the Windows Development section of the contributing documentation](https://frankenphp.dev/docs/contributing/#windows-development).
16+
1317
## Install PHP
1418

1519
FrankenPHP is compatible with PHP 8.2 and higher.

docs/production.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Deploying FrankenPHP in production with Docker Compose
3-
description: Deploy a PHP application to production with FrankenPHP and Docker Compose on a single Linux server, including TLS, reverse proxy, and multi-node setups.
2+
title: Deploying FrankenPHP in production
3+
description: Deploy a PHP application to production with FrankenPHP and Docker Compose on a single Linux server, including TLS, reverse proxy, and multi-node setups, or natively on Windows.
44
---
55

66
# Deploying in production
@@ -189,3 +189,48 @@ brew services start dunglas/frankenphp/frankenphp
189189
```
190190

191191
The service runs FrankenPHP with the configuration file located at `$(brew --prefix)/etc/Caddyfile`.
192+
193+
## Deploying on Windows
194+
195+
FrankenPHP runs natively on Windows, with full support for [the worker mode](worker.md) and [hot reloading](hot-reload.md).
196+
197+
To install it, run this in PowerShell:
198+
199+
```powershell
200+
irm https://frankenphp.dev/install.ps1 | iex
201+
```
202+
203+
Alternatively, [download the Windows archive from the releases page](https://github.com/php/frankenphp/releases).
204+
It contains the FrankenPHP executable as well as the official PHP binary for Windows.
205+
206+
To run FrankenPHP in the background and start it automatically at boot, register it as a Windows service.
207+
As [recommended by the Caddy documentation](https://caddyserver.com/docs/running#windows-service), use [WinSW](https://github.com/winsw/winsw):
208+
209+
1. Download [the latest version of WinSW](https://github.com/winsw/winsw/releases) as `frankenphp-service.exe` in the directory containing `frankenphp.exe`
210+
2. In the same directory, create a `frankenphp-service.xml` file:
211+
212+
```xml
213+
<service>
214+
<id>frankenphp</id>
215+
<name>FrankenPHP</name>
216+
<description>The modern PHP app server (https://frankenphp.dev)</description>
217+
<executable>%BASE%\frankenphp.exe</executable>
218+
<arguments>run --config %BASE%\Caddyfile</arguments>
219+
<log mode="roll-by-time">
220+
<pattern>yyyy-MM-dd</pattern>
221+
</log>
222+
</service>
223+
```
224+
225+
3. Install and start the service:
226+
227+
```powershell
228+
.\frankenphp-service.exe install
229+
.\frankenphp-service.exe start
230+
```
231+
232+
Windows services cannot be reloaded. To apply configuration changes gracefully, without restarting the service, run:
233+
234+
```powershell
235+
.\frankenphp.exe reload --config Caddyfile
236+
```

0 commit comments

Comments
 (0)