Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix and improve compilation docs #986

Merged
merged 1 commit into from
Aug 20, 2024
Merged
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
16 changes: 6 additions & 10 deletions docs/cn/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ tar xf php-*
cd php-*/
```

然后,为您的平台配置 PHP:
然后,为您的平台配置 PHP.

这些参数是必需的,但你也可以添加其他编译参数(例如额外的扩展)。

### Linux

Expand All @@ -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`:
Expand All @@ -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
```

Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/cn/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 10 additions & 16 deletions docs/compile.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 11 additions & 14 deletions docs/fr/compile.md
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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

Expand All @@ -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` :
Expand All @@ -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
Expand All @@ -77,14 +73,15 @@ 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 \
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
Expand Down
1 change: 1 addition & 0 deletions docs/fr/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 8 additions & 12 deletions docs/tr/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
```

Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion docs/tr/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down