Skip to content

Commit f8c073c

Browse files
committed
docs: deploying on Windows
1 parent 1f216dd commit f8c073c

4 files changed

Lines changed: 64 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/embed.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ EMBED=/path/to/your/app ./build-static.sh
103103

104104
The resulting binary is the file named `frankenphp-<os>-<arch>` in the `dist/` directory.
105105

106+
> [!NOTE]
107+
>
108+
> Standalone binaries can currently be created for Linux and macOS only,
109+
> as [static builds are not available for Windows](static.md).
110+
> To create a Linux binary from Windows, use the Docker-based builder or [WSL](https://learn.microsoft.com/windows/wsl/).
111+
106112
## Using the binary
107113

108114
This is it! The `my-app` file (or `dist/frankenphp-<os>-<arch>` on other OSes) contains your self-contained app!

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
@@ -171,3 +171,48 @@ which can cause issues like incorrect HTTPS detection or wrong client IP address
171171
If you want to deploy your app on a cluster of machines, you can use [Docker Swarm](https://docs.docker.com/engine/swarm/stack-deploy/),
172172
which is compatible with the provided Compose files.
173173
To deploy on Kubernetes, take a look at [the Helm chart provided with API Platform](https://api-platform.com/docs/deployment/kubernetes/), which uses FrankenPHP.
174+
175+
## Deploying on Windows
176+
177+
FrankenPHP runs natively on Windows, with full support for [the worker mode](worker.md) and [hot reloading](hot-reload.md).
178+
179+
To install it, run this in PowerShell:
180+
181+
```powershell
182+
irm https://frankenphp.dev/install.ps1 | iex
183+
```
184+
185+
Alternatively, [download the Windows archive from the releases page](https://github.com/php/frankenphp/releases).
186+
It contains the FrankenPHP executable as well as the official PHP binary for Windows.
187+
188+
To run FrankenPHP in the background and start it automatically at boot, register it as a Windows service.
189+
As [recommended by the Caddy documentation](https://caddyserver.com/docs/running#windows-service), use [WinSW](https://github.com/winsw/winsw):
190+
191+
1. Download [the latest version of WinSW](https://github.com/winsw/winsw/releases) as `frankenphp-service.exe` in the directory containing `frankenphp.exe`
192+
2. In the same directory, create a `frankenphp-service.xml` file:
193+
194+
```xml
195+
<service>
196+
<id>frankenphp</id>
197+
<name>FrankenPHP</name>
198+
<description>The modern PHP app server (https://frankenphp.dev)</description>
199+
<executable>%BASE%\frankenphp.exe</executable>
200+
<arguments>run --config %BASE%\Caddyfile</arguments>
201+
<log mode="roll-by-time">
202+
<pattern>yyyy-MM-dd</pattern>
203+
</log>
204+
</service>
205+
```
206+
207+
3. Install and start the service:
208+
209+
```powershell
210+
.\frankenphp-service.exe install
211+
.\frankenphp-service.exe start
212+
```
213+
214+
Windows services cannot be reloaded. To apply configuration changes gracefully, without restarting the service, run:
215+
216+
```powershell
217+
.\frankenphp.exe reload --config Caddyfile
218+
```

docs/static.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ When possible, we recommend using glibc-based, mostly static builds.
1919

2020
FrankenPHP also supports [embedding the PHP app in the static binary](embed.md).
2121

22+
> [!NOTE]
23+
>
24+
> Static builds are not available for Windows: on this platform, FrankenPHP links against the official PHP binaries,
25+
> which are included in [the provided archives](https://github.com/php/frankenphp/releases).
26+
> To create a static Linux binary from Windows, use the Docker-based builders or [WSL](https://learn.microsoft.com/windows/wsl/).
27+
2228
## Linux
2329

2430
We provide Docker images to build static Linux binaries:

0 commit comments

Comments
 (0)