Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions docs/cn/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ php_server

一个更高级的 `Caddyfile`,支持更多功能并提供方便的环境变量,可以在 [FrankenPHP 仓库中](https://github.com/php/frankenphp/blob/main/caddy/frankenphp/Caddyfile)找到,并随 Docker 镜像提供。

PHP 本身可以[使用 `php.ini` 文件](https://www.php.net/manual/en/configuration.file.php)进行配置。
PHP 本身可以[使用 `php.ini` 文件](https://www.php.net/manual/configuration.file.php)进行配置。

根据你的安装方法,FrankenPHP 和 PHP 解释器将在以下位置查找配置文件。

Expand Down Expand Up @@ -275,7 +275,7 @@ Workers 可以通过 `watch` 指令在文件更改时重新启动。

## PHP 配置

为了加载[附加的 PHP 配置文件](https://www.php.net/manual/en/configuration.file.php#configuration.file.scan),可以使用 `PHP_INI_SCAN_DIR` 环境变量。设置后,PHP 将加载给定目录中所有带有 `.ini` 扩展名的文件。
为了加载[附加的 PHP 配置文件](https://www.php.net/manual/configuration.file.php#configuration.file.scan),可以使用 `PHP_INI_SCAN_DIR` 环境变量。设置后,PHP 将加载给定目录中所有带有 `.ini` 扩展名的文件。

您还可以通过在 `Caddyfile` 中使用 `php_ini` 指令来更改 PHP 配置:

Expand Down
10 changes: 5 additions & 5 deletions docs/cn/known-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

| 名称 | 原因 | 替代方案 |
| ----------------------------------------------------------------------------------------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------- |
| [imap](https://www.php.net/manual/en/imap.installation.php) | 不安全的线程 | [javanile/php-imap2](https://github.com/javanile/php-imap2), [webklex/php-imap](https://github.com/Webklex/php-imap) |
| [imap](https://www.php.net/manual/imap.installation.php) | 不安全的线程 | [javanile/php-imap2](https://github.com/javanile/php-imap2), [webklex/php-imap](https://github.com/Webklex/php-imap) |
| [newrelic](https://docs.newrelic.com/docs/apm/agents/php-agent/getting-started/introduction-new-relic-php/) | 不安全的线程 | - |

## 有缺陷的 PHP 扩展
Expand All @@ -15,15 +15,15 @@

| 名称 | 问题 |
| ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [ext-openssl](https://www.php.net/manual/en/book.openssl.php) | 在使用静态构建的 FrankenPHP(使用 musl libc 构建)时,在重负载下 OpenSSL 扩展可能会崩溃。一个解决方法是使用动态链接的构建(如 Docker 镜像中使用的版本)。此错误正在由 PHP 跟踪。[查看问题](https://github.com/php/php-src/issues/13648)。 |
| [ext-openssl](https://www.php.net/manual/book.openssl.php) | 在使用静态构建的 FrankenPHP(使用 musl libc 构建)时,在重负载下 OpenSSL 扩展可能会崩溃。一个解决方法是使用动态链接的构建(如 Docker 镜像中使用的版本)。此错误正在由 PHP 跟踪。[查看问题](https://github.com/php/php-src/issues/13648)。 |

## get_browser

[get_browser()](https://www.php.net/manual/en/function.get-browser.php) 函数在一段时间后似乎表现不佳。解决方法是缓存(例如使用 [APCu](https://www.php.net/manual/zh/book.apcu.php))每个 User-Agent,因为它们是不变的。
[get_browser()](https://www.php.net/manual/function.get-browser.php) 函数在一段时间后似乎表现不佳。解决方法是缓存(例如使用 [APCu](https://www.php.net/manual/book.apcu.php))每个 User-Agent,因为它们是不变的。

## 独立的二进制和基于 Alpine 的 Docker 镜像

独立的二进制文件和基于 Alpine 的 Docker 镜像 (`dunglas/frankenphp:*-alpine`) 使用的是 [musl libc](https://musl.libc.org/) 而不是 [glibc and friends](https://www.etalabs.net/compare_libcs.html),为的是保持较小的二进制大小。这可能会导致一些兼容性问题。特别是,glob 标志 `GLOB_BRACE` [不可用](https://www.php.net/manual/en/function.glob.php)。
独立的二进制文件和基于 Alpine 的 Docker 镜像 (`dunglas/frankenphp:*-alpine`) 使用的是 [musl libc](https://musl.libc.org/) 而不是 [glibc and friends](https://www.etalabs.net/compare_libcs.html),为的是保持较小的二进制大小。这可能会导致一些兼容性问题。特别是,glob 标志 `GLOB_BRACE` [不可用](https://www.php.net/manual/function.glob.php)。

## 在 Docker 中使用 `https://127.0.0.1`

Expand Down Expand Up @@ -122,7 +122,7 @@ error:0A000086:SSL routines::certificate verify failed

由于静态二进制不捆绑 TLS 证书,因此您需要将 OpenSSL 指向本地 CA 证书安装。

检查 [`openssl_get_cert_locations()`](https://www.php.net/manual/en/function.openssl-get-cert-locations.php) 的输出,
检查 [`openssl_get_cert_locations()`](https://www.php.net/manual/function.openssl-get-cert-locations.php) 的输出,
以找到 CA 证书必须安装的位置,并将它们存储在该位置。

> [!WARNING]
Expand Down
6 changes: 3 additions & 3 deletions docs/cn/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
`max_threads` 可以帮助你确定需要多少线程来处理你的流量,并可以使服务器对延迟峰值更具弹性。
如果设置为 `auto`,限制将基于你的 `php.ini` 中的 `memory_limit` 进行估算。如果无法这样做,
`auto` 将默认为 2x `num_threads`。请记住,`auto` 可能会严重低估所需的线程数。
`max_threads` 类似于 PHP FPM 的 [pm.max_children](https://www.php.net/manual/en/install.fpm.configuration.php#pm.max-children)。主要区别是 FrankenPHP 使用线程而不是
`max_threads` 类似于 PHP FPM 的 [pm.max_children](https://www.php.net/manual/install.fpm.configuration.php#pm.max-children)。主要区别是 FrankenPHP 使用线程而不是
进程,并根据需要自动在不同的 worker 脚本和"经典模式"之间委派它们。

## Worker 模式
Expand Down Expand Up @@ -160,10 +160,10 @@ FrankenPHP 使用官方 PHP 解释器。

特别是:

- 检查 [OPcache](https://www.php.net/manual/zh/book.opcache.php) 是否已安装、启用并正确配置
- 检查 [OPcache](https://www.php.net/manual/book.opcache.php) 是否已安装、启用并正确配置
- 启用 [Composer 自动加载器优化](https://getcomposer.org/doc/articles/autoloader-optimization.md)
- 确保 `realpath` 缓存对于你的应用程序需求足够大
- 使用[预加载](https://www.php.net/manual/zh/opcache.preloading.php)
- 使用[预加载](https://www.php.net/manual/opcache.preloading.php)

有关更多详细信息,请阅读[专门的 Symfony 文档条目](https://symfony.com/doc/current/performance.html)
(即使你不使用 Symfony,大多数提示也很有用)。
Expand Down
2 changes: 1 addition & 1 deletion docs/cn/worker.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ frankenphp {

## 超全局变量行为

[PHP 超全局变量](https://www.php.net/manual/zh/language.variables.superglobals.php)(`$_SERVER`、`$_ENV`、`$_GET`...)
[PHP 超全局变量](https://www.php.net/manual/language.variables.superglobals.php)(`$_SERVER`、`$_ENV`、`$_GET`...)
行为如下:

- 在第一次调用 `frankenphp_handle_request()` 之前,超全局变量包含绑定到 worker 脚本本身的值
Expand Down
4 changes: 2 additions & 2 deletions docs/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Alternatively, [fully and mostly static builds](static.md) can also be created.

## Install PHP

FrankenPHP is compatible with PHP 8.2 and superior.
FrankenPHP is compatible with PHP 8.2 and higher.

### With Homebrew (Linux and Mac)

Expand Down Expand Up @@ -97,7 +97,7 @@ You can now build the final binary.
### Using xcaddy

The recommended way is to use [xcaddy](https://github.com/caddyserver/xcaddy) to compile FrankenPHP.
`xcaddy` also allows to easily add [custom Caddy modules](https://caddyserver.com/docs/modules/) and FrankenPHP extensions:
`xcaddy` also makes it easy to add [custom Caddy modules](https://caddyserver.com/docs/modules/) and FrankenPHP extensions:

```console
CGO_ENABLED=1 \
Expand Down
10 changes: 5 additions & 5 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: Configure FrankenPHP and Caddy via Caddyfile, JSON, or environment

# Configuration

FrankenPHP, Caddy as well as the [Mercure](mercure.md) and [Vulcain](https://vulcain.rocks) modules can be configured using [the formats supported by Caddy](https://caddyserver.com/docs/getting-started#your-first-config).
FrankenPHP, Caddy, as well as the [Mercure](mercure.md) and [Vulcain](https://vulcain.rocks) modules, can be configured using [the formats supported by Caddy](https://caddyserver.com/docs/getting-started#your-first-config).

The most common format is the `Caddyfile`, which is a simple, human-readable text format.
By default, FrankenPHP will look for a `Caddyfile` in the current directory.
Expand All @@ -25,7 +25,7 @@ php_server
A more advanced `Caddyfile` enabling more features and providing convenient environment variables is provided [in the FrankenPHP repository](https://github.com/php/frankenphp/blob/main/caddy/frankenphp/Caddyfile),
and with Docker images.

PHP itself can be configured [using a `php.ini` file](https://www.php.net/manual/en/configuration.file.php).
PHP itself can be configured [using a `php.ini` file](https://www.php.net/manual/configuration.file.php).

Depending on your installation method, FrankenPHP and the PHP interpreter will look for configuration files in locations described below.

Expand Down Expand Up @@ -301,11 +301,11 @@ The following environment variables can be used to inject Caddy directives in th

As for FPM and CLI SAPIs, environment variables are exposed by default in the `$_SERVER` superglobal.

The `S` value of [the `variables_order` PHP directive](https://www.php.net/manual/en/ini.core.php#ini.variables-order) is always equivalent to `ES` regardless of the placement of `E` elsewhere in this directive.
The `S` value of [the `variables_order` PHP directive](https://www.php.net/manual/ini.core.php#ini.variables-order) is always equivalent to `ES` regardless of the placement of `E` elsewhere in this directive.

## PHP config

To load [additional PHP configuration files](https://www.php.net/manual/en/configuration.file.php#configuration.file.scan),
To load [additional PHP configuration files](https://www.php.net/manual/configuration.file.php#configuration.file.scan),
the `PHP_INI_SCAN_DIR` environment variable can be used.
When set, PHP will load all the files with the `.ini` extension present in the given directories.

Expand Down Expand Up @@ -338,7 +338,7 @@ If you want to use HTTPS with the `127.0.0.1` IP address instead of the `localho
### Full duplex (HTTP/1)

When using HTTP/1.x, it may be desirable to enable full-duplex mode to allow writing a response before the entire body
has been read. (for example: [Mercure](mercure.md), WebSocket, Server-Sent Events, etc.)
has been read (for example: [Mercure](mercure.md), WebSocket, Server-Sent Events, etc.).

This is an opt-in configuration that needs to be added to the global options in the `Caddyfile`:

Expand Down
6 changes: 3 additions & 3 deletions docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ COPY --from=builder /usr/local/bin/frankenphp /usr/local/bin/frankenphp
```

The `builder` image provided by FrankenPHP contains a compiled version of `libphp`.
[Builders images](https://hub.docker.com/r/dunglas/frankenphp/tags?name=builder) are provided for all versions of FrankenPHP and PHP, both for Debian and Alpine.
[Builder images](https://hub.docker.com/r/dunglas/frankenphp/tags?name=builder) are provided for all versions of FrankenPHP and PHP, both for Debian and Alpine.

> [!TIP]
>
Expand Down Expand Up @@ -121,7 +121,7 @@ docker run -v $PWD:/app/public -p 80:80 -p 443:443 -p 443:443/udp --tty my-php-a

> [!TIP]
>
> The `--tty` option allows to have nice human-readable logs instead of JSON logs.
> The `--tty` option provides nice human-readable logs instead of JSON logs.

With Docker Compose:

Expand All @@ -143,7 +143,7 @@ services:
- ./:/app/public
- caddy_data:/data
- caddy_config:/config
# comment the following line in production, it allows to have nice human-readable logs in dev
# comment the following line in production, it provides nice human-readable logs in dev
tty: true

# Volumes needed for Caddy certificates and configuration
Expand Down
2 changes: 1 addition & 1 deletion docs/embed.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,5 @@ To customize the extensions, use the `PHP_EXTENSIONS` environment variable.

On Linux, the created binary is compressed using [UPX](https://upx.github.io).

On Mac, to reduce the size of the file before sending it, you can compress it.
On macOS, to reduce the size of the file before sending it, you can compress it.
We recommend `xz`.
2 changes: 1 addition & 1 deletion docs/es/classic.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Usando el Modo Clásico
# Usando el modo clásico

Sin ninguna configuración adicional, FrankenPHP opera en modo clásico. En este modo, FrankenPHP funciona como un servidor PHP tradicional, sirviendo directamente archivos PHP. Esto lo convierte en un reemplazo directo para PHP-FPM o Apache con mod_php.

Expand Down
6 changes: 3 additions & 3 deletions docs/es/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ php_server
Un `Caddyfile` más avanzado que habilita más características y proporciona variables de entorno convenientes está disponible [en el repositorio de FrankenPHP](https://github.com/php/frankenphp/blob/main/caddy/frankenphp/Caddyfile),
y con las imágenes de Docker.

PHP en sí puede configurarse [usando un archivo `php.ini`](https://www.php.net/manual/es/configuration.file.php).
PHP en sí puede configurarse [usando un archivo `php.ini`](https://www.php.net/manual/configuration.file.php).

Dependiendo de su método de instalación, FrankenPHP y el intérprete de PHP buscarán archivos de configuración en las ubicaciones descritas a continuación.

Expand Down Expand Up @@ -275,11 +275,11 @@ Las siguientes variables de entorno pueden usarse para inyectar directivas de Ca

Al igual que en FPM y SAPIs CLI, las variables de entorno se exponen por defecto en la superglobal `$_SERVER`.

El valor `S` de [la directiva `variables_order` de PHP](https://www.php.net/manual/en/ini.core.php#ini.variables-order) siempre es equivalente a `ES` independientemente de la ubicación de `E` en otro lugar de esta directiva.
El valor `S` de [la directiva `variables_order` de PHP](https://www.php.net/manual/ini.core.php#ini.variables-order) siempre es equivalente a `ES` independientemente de la ubicación de `E` en otro lugar de esta directiva.

## Configuración de PHP

Para cargar [archivos de configuración adicionales de PHP](https://www.php.net/manual/en/configuration.file.php#configuration.file.scan),
Para cargar [archivos de configuración adicionales de PHP](https://www.php.net/manual/configuration.file.php#configuration.file.scan),
puede usarse la variable de entorno `PHP_INI_SCAN_DIR`.
Cuando se establece, PHP cargará todos los archivos con la extensión `.ini` presentes en los directorios dados.

Expand Down
6 changes: 3 additions & 3 deletions docs/es/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Se proporcionan [imágenes de constructor](https://hub.docker.com/r/dunglas/fran
> Si está usando Alpine Linux y Symfony,
> es posible que deba [aumentar el tamaño de pila predeterminado](compile.md#using-xcaddy).

## Habilitar el modo Worker por defecto
## Habilitar el modo worker por defecto

Establezca la variable de entorno `FRANKENPHP_CONFIG` para iniciar FrankenPHP con un script de worker:

Expand Down Expand Up @@ -200,7 +200,7 @@ Las imágenes Docker se construyen:
- Cuando se etiqueta una nueva versión
- Diariamente a las 4 am UTC, si hay nuevas versiones de las imágenes oficiales de PHP disponibles

## Endurecimiento de Imágenes
## Endurecimiento de imágenes

Para reducir aún más la superficie de ataque y el tamaño de tus imágenes Docker de FrankenPHP, también es posible construirlas sobre una imagen
[Google distroless](https://github.com/GoogleContainerTools/distroless) o
Expand Down Expand Up @@ -260,7 +260,7 @@ COPY --from=builder /tmp/libs /usr/lib
COPY --from=builder /usr/local/etc/php/conf.d /usr/local/etc/php/conf.d
COPY --from=builder /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini

# Directorios de datos de Caddy deben ser escribibles para nonroot, incluso en un sistema de archivos raíz de solo lectura
# Directorios de datos de Caddy: deben ser escribibles para nonroot, incluso en un sistema de archivos raíz de solo lectura
ENV XDG_CONFIG_HOME=/config \
XDG_DATA_HOME=/data
COPY --from=builder --chown=nonroot:nonroot /data/caddy /data/caddy
Expand Down
2 changes: 1 addition & 1 deletion docs/es/early-hints.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Early Hints (Pistas Tempranas)
# Early Hints (pistas tempranas)

FrankenPHP soporta nativamente el [código de estado 103 Early Hints](https://developer.chrome.com/blog/early-hints/).
El uso de Early Hints puede mejorar el tiempo de carga de sus páginas web hasta en un 30%.
Expand Down
16 changes: 8 additions & 8 deletions docs/es/embed.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Aplicaciones PHP como Binarios Autónomos
# Aplicaciones PHP como binarios autónomos

FrankenPHP tiene la capacidad de incrustar el código fuente y los activos de aplicaciones PHP en un binario estático y autónomo.

Expand All @@ -8,7 +8,7 @@ Obtenga más información sobre esta característica [en la presentación realiz

Para incrustar aplicaciones Laravel, [lea esta entrada específica de documentación](laravel.md#laravel-apps-as-standalone-binaries).

## Preparando su Aplicación
## Preparando su aplicación

Antes de crear el binario autónomo, asegúrese de que su aplicación esté lista para ser incrustada.

Expand Down Expand Up @@ -42,12 +42,12 @@ composer install --ignore-platform-reqs --no-dev -a
composer dump-env prod
```

### Personalizar la Configuración
### Personalizar la configuración

Para personalizar [la configuración](config.md), puede colocar un archivo `Caddyfile` así como un archivo `php.ini`
en el directorio principal de la aplicación a incrustar (`$TMPDIR/my-prepared-app` en el ejemplo anterior).

## Crear un Binario para Linux
## Crear un binario para Linux

La forma más fácil de crear un binario para Linux es usar el constructor basado en Docker que proporcionamos.

Expand Down Expand Up @@ -85,7 +85,7 @@ La forma más fácil de crear un binario para Linux es usar el constructor basad

El binario resultante es el archivo llamado `my-app` en el directorio actual.

## Crear un Binario para Otros Sistemas Operativos
## Crear un binario para otros sistemas operativos

Si no desea usar Docker o desea construir un binario para macOS, use el script de shell que proporcionamos:

Expand All @@ -97,7 +97,7 @@ EMBED=/path/to/your/app ./build-static.sh

El binario resultante es el archivo llamado `frankenphp-<os>-<arch>` en el directorio `dist/`.

## Usar el Binario
## Usar el binario

¡Listo! El archivo `my-app` (o `dist/frankenphp-<os>-<arch>` en otros sistemas operativos) contiene su aplicación autónoma.

Expand Down Expand Up @@ -132,11 +132,11 @@ Si el archivo `composer.json` no existe, se construirán las extensiones predete

Para personalizar las extensiones, use la variable de entorno `PHP_EXTENSIONS`.

## Personalizar la Compilación
## Personalizar la compilación

[Lea la documentación de compilación estática](static.md) para ver cómo personalizar el binario (extensiones, versión de PHP, etc.).

## Distribuir el Binario
## Distribuir el binario

En Linux, el binario creado se comprime usando [UPX](https://upx.github.io).

Expand Down
Loading