From 9232e91bb0287183179e2fdbbc060ab4ad6dbb62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Tue, 20 Aug 2024 03:51:29 +0200 Subject: [PATCH] docs: fix and improve compilation docs --- docs/cn/compile.md | 16 ++++++---------- docs/cn/docker.md | 1 + docs/compile.md | 26 ++++++++++---------------- docs/docker.md | 2 +- docs/fr/compile.md | 25 +++++++++++-------------- docs/fr/docker.md | 1 + docs/tr/compile.md | 20 ++++++++------------ docs/tr/docker.md | 3 ++- 8 files changed, 40 insertions(+), 54 deletions(-) diff --git a/docs/cn/compile.md b/docs/cn/compile.md index 8958e7eb2f..4f80d62272 100644 --- a/docs/cn/compile.md +++ b/docs/cn/compile.md @@ -16,7 +16,9 @@ tar xf php-* cd php-*/ ``` -然后,为您的平台配置 PHP: +然后,为您的平台配置 PHP. + +这些参数是必需的,但你也可以添加其他编译参数(例如额外的扩展)。 ### Linux @@ -28,13 +30,6 @@ cd php-*/ --enable-zend-max-execution-timers ``` -最后,编译并安装 PHP: - -```console -make -j$(nproc) -sudo make install -``` - ### Mac 使用 [Homebrew](https://brew.sh/) 包管理器安装 `libiconv`、`bison`、`re2c` 和 `pkg-config`: @@ -57,12 +52,12 @@ echo 'export PATH="/opt/homebrew/opt/bison/bin:$PATH"' >> ~/.zshrc --with-iconv=/opt/homebrew/opt/libiconv/ ``` -这些参数是必需的,但你也可以添加其他编译参数(例如额外的扩展)。 +## 编译并安装 PHP: 最后,编译并安装 PHP: ```console -make -j$(sysctl -n hw.logicalcpu) +make -j"$(getconf _NPROCESSORS_ONLN)" sudo make install ``` @@ -86,6 +81,7 @@ XCADDY_GO_BUILD_FLAGS="-ldflags '-w -s'" \ xcaddy build \ --output frankenphp \ --with github.com/dunglas/frankenphp/caddy \ + --with github.com/dunglas/caddy-cbrotli \ --with github.com/dunglas/mercure/caddy \ --with github.com/dunglas/vulcain/caddy # Add extra Caddy modules here diff --git a/docs/cn/docker.md b/docs/cn/docker.md index 918237961d..54b3b9aff2 100644 --- a/docs/cn/docker.md +++ b/docs/cn/docker.md @@ -55,6 +55,7 @@ RUN xcaddy build \ --output /usr/local/bin/frankenphp \ --with github.com/dunglas/frankenphp=./ \ --with github.com/dunglas/frankenphp/caddy=./caddy/ \ + --with github.com/dunglas/caddy-cbrotli \ # Mercure 和 Vulcain 包含在官方版本中,如果不需要你可以删除它们 --with github.com/dunglas/mercure/caddy \ --with github.com/dunglas/vulcain/caddy diff --git a/docs/compile.md b/docs/compile.md index e7ed9ab696..307acfca5f 100644 --- a/docs/compile.md +++ b/docs/compile.md @@ -1,22 +1,23 @@ # Compile From Sources -This document explain how to create a FrankenPHP build that will load PHP as a dynamic library. +This document explains how to create a FrankenPHP binary that will load PHP as a dynamic library. This is the recommended method. -Alternatively, [creating static builds](static.md) is also possible. +Alternatively, [static builds](static.md) can also be created. ## Install PHP -FrankenPHP is compatible with the PHP 8.2 and superior. +FrankenPHP is compatible with PHP 8.2 and superior. -First, [get the sources of PHP](https://www.php.net/downloads.php) and extract them: +First, [get the PHP sources](https://www.php.net/downloads.php) and extract them: ```console tar xf php-* cd php-*/ ``` -Then, configure PHP for your platform: +Then, run the `configure` script with the options needed for your platform. +Th following `./configure` flags are mandatory, but you can add others, for example to compile extensions or additional features. ### Linux @@ -28,13 +29,6 @@ Then, configure PHP for your platform: --enable-zend-max-execution-timers ``` -Finally, compile and install PHP: - -```console -make -j$(nproc) -sudo make install -``` - ### Mac Use the [Homebrew](https://brew.sh/) package manager to install @@ -58,19 +52,18 @@ Then run the configure script: --with-iconv=/opt/homebrew/opt/libiconv/ ``` -These flags are required, but you can add other flags (e.g. extra extensions) -if needed. +## Compile PHP Finally, compile and install PHP: ```console -make -j$(sysctl -n hw.logicalcpu) +make -j"$(getconf _NPROCESSORS_ONLN)" sudo make install ``` ## Compile the Go App -You can now use the Go library and compile our Caddy build: +You can now build the final binary: ```console curl -L https://github.com/dunglas/frankenphp/archive/refs/heads/main.tar.gz | tar xz @@ -88,6 +81,7 @@ XCADDY_GO_BUILD_FLAGS="-ldflags '-w -s'" \ xcaddy build \ --output frankenphp \ --with github.com/dunglas/frankenphp/caddy \ + --with github.com/dunglas/caddy-cbrotli \ --with github.com/dunglas/mercure/caddy \ --with github.com/dunglas/vulcain/caddy # Add extra Caddy modules here diff --git a/docs/docker.md b/docs/docker.md index a0b65deee4..bb3790561d 100644 --- a/docs/docker.md +++ b/docs/docker.md @@ -63,8 +63,8 @@ RUN xcaddy build \ --output /usr/local/bin/frankenphp \ --with github.com/dunglas/frankenphp=./ \ --with github.com/dunglas/frankenphp/caddy=./caddy/ \ - # Mercure and Vulcain are included in the official build, but feel free to remove them --with github.com/dunglas/caddy-cbrotli \ + # Mercure and Vulcain are included in the official build, but feel free to remove them --with github.com/dunglas/mercure/caddy \ --with github.com/dunglas/vulcain/caddy # Add extra Caddy modules here diff --git a/docs/fr/compile.md b/docs/fr/compile.md index 79c1e91a35..a163068143 100644 --- a/docs/fr/compile.md +++ b/docs/fr/compile.md @@ -1,8 +1,9 @@ # Compiler depuis les sources -Ce document explique comment créer un build FrankenPHP qui chargera PHP comme une bibliothèque dynamique. C'est la méthode recommandée. +Ce document explique comment créer un build FrankenPHP qui chargera PHP en tant que bibliothèque dynamique. +C'est la méthode recommandée. -En alternative, il est aussi possible de [créer des builds statiques](static.md). +Alternativement, il est aussi possible de [créer des builds statiques](static.md). ## Installer PHP @@ -15,7 +16,9 @@ tar xf php-* cd php-*/ ``` -Ensuite, configurez PHP pour votre système d'exploitation : +Ensuite, configurez PHP pour votre système d'exploitation. + +Les options de configuration suivantes sont nécessaires pour la compilation, mais vous pouvez également inclure d'autres options selon vos besoins, par exemple pour ajouter des extensions et fonctionnalités supplémentaires. ### Linux @@ -27,13 +30,6 @@ Ensuite, configurez PHP pour votre système d'exploitation : --enable-zend-max-execution-timers ``` -Finalement, compilez et installez PHP : - -```console -make -j$(nproc) -sudo make install -``` - ### Mac Utilisez le gestionnaire de paquets [Homebrew](https://brew.sh/) pour installer `libiconv`, `bison`, `re2c` et `pkg-config` : @@ -56,18 +52,18 @@ Puis exécutez le script de configuration : --with-iconv=/opt/homebrew/opt/libiconv/ ``` -Les options de configuration spécifiées sont nécessaires pour la compilation, mais vous pouvez également inclure d'autres options selon vos besoins, par exemple pour ajouter des extensions supplémentaires. +## Compilez PHP Finalement, compilez et installez PHP : ```console -make -j$(sysctl -n hw.logicalcpu) +make -j"$(getconf _NPROCESSORS_ONLN)" sudo make install ``` ## Compiler l'application Go -Vous pouvez maintenant utiliser la bibliothèque Go et compiler notre build de Caddy : +Vous pouvez maintenant compilez FrankenPHP : ```console curl -L https://github.com/dunglas/frankenphp/archive/refs/heads/main.tar.gz | tar x @@ -77,7 +73,7 @@ CGO_CFLAGS=$(php-config --includes) CGO_LDFLAGS="$(php-config --ldflags) $(php-c ### Utiliser xcaddy -Vous pouvez utiliser à la place [xcaddy](https://github.com/caddyserver/xcaddy) pour compiler FrankenPHP avec [des modules Caddy additionnels](https://caddyserver.com/docs/modules/): +Alternativement, Vous pouvez utiliser [xcaddy](https://github.com/caddyserver/xcaddy) pour compiler FrankenPHP avec [des modules Caddy additionnels](https://caddyserver.com/docs/modules/): ```console CGO_ENABLED=1 \ @@ -85,6 +81,7 @@ XCADDY_GO_BUILD_FLAGS="-ldflags '-w -s'" \ xcaddy build \ --output frankenphp \ --with github.com/dunglas/frankenphp/caddy \ + --with github.com/dunglas/caddy-cbrotli \ --with github.com/dunglas/mercure/caddy \ --with github.com/dunglas/vulcain/caddy # Add extra Caddy modules here diff --git a/docs/fr/docker.md b/docs/fr/docker.md index 5b650600ae..1cb6b4541c 100644 --- a/docs/fr/docker.md +++ b/docs/fr/docker.md @@ -56,6 +56,7 @@ RUN xcaddy build \ --output /usr/local/bin/frankenphp \ --with github.com/dunglas/frankenphp=./ \ --with github.com/dunglas/frankenphp/caddy=./caddy/ \ + --with github.com/dunglas/caddy-cbrotli \ # Mercure et Vulcain sont inclus dans la construction officielle, mais n'hésitez pas à les retirer --with github.com/dunglas/mercure/caddy \ --with github.com/dunglas/vulcain/caddy diff --git a/docs/tr/compile.md b/docs/tr/compile.md index 6c3c91db62..b0504062dd 100644 --- a/docs/tr/compile.md +++ b/docs/tr/compile.md @@ -16,7 +16,10 @@ tar xf php-* cd php-*/ ``` -Ardından, PHP'yi platformunuz için yapılandırın: +Ardından, PHP'yi platformunuz için yapılandırın. + +Bu şekilde yapılandırma gereklidir, ancak başka opsiyonlar da ekleyebilirsiniz (örn. ekstra uzantılar) +İhtiyaç halinde. ### Linux @@ -28,13 +31,6 @@ Ardından, PHP'yi platformunuz için yapılandırın: --enable-zend-max-execution-timers ``` -Son olarak, PHP'yi derleyin ve kurun: - -```console -make -j$(nproc) -sudo make install -``` - ### Mac Yüklemek için [Homebrew](https://brew.sh/) paket yöneticisini kullanın @@ -58,13 +54,12 @@ Ardından yapılandırma betiğini çalıştırın: --with-iconv=/opt/homebrew/opt/libiconv/ ``` -Bu şekilde yapılandırma gereklidir, ancak başka opsiyonlar da ekleyebilirsiniz (örn. ekstra uzantılar) -İhtiyaç halinde. +## PHP Derleyin -Son olarak, PHP'yi derleyin ve yükleyin: +Son olarak, PHP'yi derleyin ve kurun: ```console -make -j$(sysctl -n hw.logicalcpu) +make -j"$(getconf _NPROCESSORS_ONLN)" sudo make install ``` @@ -88,6 +83,7 @@ XCADDY_GO_BUILD_FLAGS="-ldflags '-w -s'" \ xcaddy build \ --output frankenphp \ --with github.com/dunglas/frankenphp/caddy \ + --with github.com/dunglas/caddy-cbrotli \ --with github.com/dunglas/mercure/caddy \ --with github.com/dunglas/vulcain/caddy # Add extra Caddy modules here diff --git a/docs/tr/docker.md b/docs/tr/docker.md index 0c52da8d4a..b427a9174c 100644 --- a/docs/tr/docker.md +++ b/docs/tr/docker.md @@ -56,8 +56,9 @@ RUN xcaddy build \ --output /usr/local/bin/frankenphp \ --with github.com/dunglas/frankenphp=./ \ --with github.com/dunglas/frankenphp/caddy=./caddy/ \ - # Mercure ve Vulcain resmi yapıya dahil edilmiştir, ancak bunları kaldırmaktan çekinmeyin --with github.com/dunglas/caddy-cbrotli \ + --with github.com/dunglas/caddy-cbrotli \ + # Mercure ve Vulcain resmi yapıya dahil edilmiştir, ancak bunları kaldırmaktan çekinmeyin --with github.com/dunglas/mercure/caddy \ --with github.com/dunglas/vulcain/caddy # Buraya ekstra Caddy modülleri ekleyin