docs: fix and improve compilation docs

This commit is contained in:
Kévin Dunglas
2024-08-20 03:51:29 +02:00
parent 7a524ddbd5
commit 60e3aba981
8 changed files with 40 additions and 54 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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