Skip to content

Commit f28f6e8

Browse files
henderkesdunglas
andauthored
docs: update docs for rpm packages and extension availability (#1988)
continues #1756 --------- Co-authored-by: Kévin Dunglas <[email protected]>
1 parent 01beb66 commit f28f6e8

File tree

7 files changed

+123
-182
lines changed

7 files changed

+123
-182
lines changed

.github/workflows/static.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ jobs:
297297
targets: static-builder-gnu
298298
set: |
299299
${{ (github.event_name == 'pull_request' || matrix.platform == 'linux/arm64') && 'static-builder-gnu.args.NO_COMPRESS=1' || '' }}
300-
static-builder-gnu.args.BUILD_PACKAGES=1
301300
*.tags=
302301
*.platform=${{ matrix.platform }}
303302
*.cache-from=type=gha,scope=${{ needs.prepare.outputs.ref || github.ref }}-static-builder-gnu

README.md

Lines changed: 60 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,49 +16,69 @@ FrankenPHP can also be used as a standalone Go library to embed PHP in any app u
1616

1717
## Getting Started
1818

19-
### Standalone Binary
20-
21-
We provide static FrankenPHP binaries for Linux and macOS
22-
containing [PHP 8.4](https://www.php.net/releases/8.4/en.php) and most popular PHP extensions.
23-
2419
On Windows, use [WSL](https://learn.microsoft.com/windows/wsl/) to run FrankenPHP.
2520

26-
[Download FrankenPHP](https://github.com/php/frankenphp/releases) or copy this line into your
27-
terminal to automatically install the version appropriate for your platform:
21+
### Install Script
22+
23+
You can copy this line into your terminal to automatically
24+
install an appropriate version for your platform:
2825

2926
```console
3027
curl https://frankenphp.dev/install.sh | sh
3128
mv frankenphp /usr/local/bin/
3229
```
3330

34-
To serve the content of the current directory, run:
31+
### Standalone Binary
32+
33+
We provide static FrankenPHP binaries for development purposes on Linux and macOS
34+
containing [PHP 8.4](https://www.php.net/releases/8.4/en.php) and most popular PHP extensions.
35+
36+
[Download FrankenPHP](https://github.com/php/frankenphp/releases)
37+
38+
### rpm Packages
39+
40+
Our maintainers offer rpm packages for all systems using `dnf`. To install, run:
3541

3642
```console
37-
frankenphp php-server
43+
sudo dnf install https://rpm.henderkes.com/static-php-1-0.noarch.rpm
44+
sudo dnf module enable php-zts:static-8.4 # 8.2-8.5 available
45+
sudo dnf install frankenphp
46+
# to install extensions:
47+
sudo dnf install php-zts-xdebug
48+
# if an extension is not available by default, install it with pie
49+
sudo dnf install php-zts-devel
50+
sudo pie install asgrim/example-pie-extension --with-php-config=php-config-zts
3851
```
3952

40-
You can also run command-line scripts with:
53+
### deb Packages
54+
55+
Our maintainers offer deb packages for all systems using `apt`. To install, run:
4156

4257
```console
43-
frankenphp php-cli /path/to/your/script.php
58+
sudo curl -fsSL https://key.henderkes.com/static-php.gpg -o /usr/share/keyrings/static-php.gpg && \
59+
echo "deb [signed-by=/usr/share/keyrings/static-php.gpg] https://deb.henderkes.com/ stable main" | sudo tee /etc/apt/sources.list.d/static-php.list && \
60+
sudo apt update
61+
sudo apt install frankenphp
62+
# to install extensions:
63+
sudo apt install php-zts-xdebug
64+
# if an extension is not available by default, install it with pie
65+
sudo apt install php-zts-devel
66+
sudo pie install asgrim/example-pie-extension --with-php-config=php-config-zts
4467
```
4568

46-
### Docker
69+
### Usage
4770

48-
Alternatively, [Docker images](https://frankenphp.dev/docs/docker/) are available:
71+
To serve the content of the current directory, run:
4972

5073
```console
51-
docker run -v .:/app/public \
52-
-p 80:80 -p 443:443 -p 443:443/udp \
53-
dunglas/frankenphp
74+
frankenphp php-server
5475
```
5576

56-
Go to `https://localhost`, and enjoy!
77+
You can also run command-line scripts with:
5778

58-
> [!TIP]
59-
>
60-
> Do not attempt to use `https://127.0.0.1`. Use `https://localhost` and accept the self-signed certificate.
61-
> Use the [`SERVER_NAME` environment variable](docs/config.md#environment-variables) to change the domain to use.
79+
```console
80+
frankenphp php-cli /path/to/your/script.php
81+
```
6282

6383
### Homebrew
6484

@@ -76,6 +96,25 @@ To serve the content of the current directory, run:
7696
frankenphp php-server
7797
```
7898

99+
If you need extensions, you will have to install them with [pie](https://github.com/php/pie).
100+
101+
### Docker
102+
103+
Alternatively, [Docker images](https://frankenphp.dev/docs/docker/) are available:
104+
105+
```console
106+
docker run -v .:/app/public \
107+
-p 80:80 -p 443:443 -p 443:443/udp \
108+
dunglas/frankenphp
109+
```
110+
111+
Go to `https://localhost`, and enjoy!
112+
113+
> [!TIP]
114+
>
115+
> Do not attempt to use `https://127.0.0.1`. Use `https://localhost` and accept the self-signed certificate.
116+
> Use the [`SERVER_NAME` environment variable](docs/config.md#environment-variables) to change the domain to use.
117+
79118
## Docs
80119

81120
- [Classic mode](https://frankenphp.dev/docs/classic/)

build-packages.sh

Lines changed: 0 additions & 119 deletions
This file was deleted.

build-static.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,9 @@ for pkg in ${SPC_OPT_INSTALL_ARGS}; do
203203
done
204204
# shellcheck disable=SC2086
205205
${spcCommand} download --with-php="${PHP_VERSION}" --for-extensions="${PHP_EXTENSIONS}" --for-libs="${PHP_EXTENSION_LIBS}" ${SPC_OPT_DOWNLOAD_ARGS}
206+
export FRANKENPHP_SOURCE_PATH="${CURRENT_DIR}"
206207
# shellcheck disable=SC2086
207-
FRANKENPHP_SOURCE_DIR=${CURRENT_DIR} ${spcCommand} build --enable-zts --build-embed --build-frankenphp ${SPC_OPT_BUILD_ARGS} "${PHP_EXTENSIONS}" --with-libs="${PHP_EXTENSION_LIBS}"
208+
${spcCommand} build --enable-zts --build-embed --build-frankenphp ${SPC_OPT_BUILD_ARGS} "${PHP_EXTENSIONS}" --with-libs="${PHP_EXTENSION_LIBS}"
208209

209210
if [ -n "$CI" ]; then
210211
rm -rf ./downloads

docs/performance.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,9 @@ especially when compiled in ZTS mode (thread-safe), which is required for Franke
4141

4242
Also, [some bugs only happen when using musl](https://github.com/php/php-src/issues?q=sort%3Aupdated-desc+is%3Aissue+is%3Aopen+label%3ABug+musl).
4343

44-
In production environments, we recommend using FrankenPHP linked against glibc.
44+
In production environments, we recommend using FrankenPHP linked against glibc, compiled with an appropriate optimization level.
4545

46-
This can be achieved by using the Debian Docker images (the default), downloading the -gnu suffix binary from our [Releases](https://github.com/php/frankenphp/releases), or by [compiling FrankenPHP from sources](compile.md).
47-
48-
Alternatively, we provide static musl binaries compiled with [the mimalloc allocator](https://github.com/microsoft/mimalloc), which alleviates the problems in threaded scenarios.
46+
This can be achieved by using the Debian Docker images, using our maintainers [.deb](https://debs.henderkes.com) or [.rpm](https://rpms.henderkes.com) packages, or by [compiling FrankenPHP from sources](compile.md).
4947

5048
## Go Runtime Configuration
5149

install.sh

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
set -e
44

5+
SUDO=""
6+
if [ "$(id -u)" -ne 0 ]; then
7+
SUDO="sudo"
8+
fi
9+
510
if [ -z "${BIN_DIR}" ]; then
611
BIN_DIR=$(pwd)
712
fi
@@ -13,6 +18,11 @@ OS=$(uname -s)
1318
ARCH=$(uname -m)
1419
GNU=""
1520

21+
if ! command -v curl >/dev/null 2>&1; then
22+
echo "Please install curl to download FrankenPHP"
23+
exit 1
24+
fi
25+
1626
if type "tput" >/dev/null 2>&1; then
1727
bold=$(tput bold || true)
1828
italic=$(tput sitm || true)
@@ -21,6 +31,46 @@ fi
2131

2232
case ${OS} in
2333
Linux*)
34+
if [ "${ARCH}" = "aarch64" ] || [ "${ARCH}" = "x86_64" ]; then
35+
if command -v dnf >/dev/null 2>&1; then
36+
echo "📦 Detected dnf. Installing FrankenPHP from RPM repository..."
37+
if [ -n "${SUDO}" ]; then
38+
echo "❗ Enter your password to grant sudo powers for package installation"
39+
${SUDO} -v || true
40+
fi
41+
${SUDO} dnf -y install https://rpm.henderkes.com/static-php-1-0.noarch.rpm
42+
${SUDO} dnf -y module enable php-zts:static-8.4 || true
43+
${SUDO} dnf -y install frankenphp
44+
echo
45+
echo "🥳 FrankenPHP installed successfully"
46+
echo
47+
echo "⭐ If you like FrankenPHP, please give it a star on GitHub: ${italic}https://github.com/php/frankenphp${normal}"
48+
exit 0
49+
fi
50+
51+
if command -v apt >/dev/null 2>&1 || command -v apt-get >/dev/null 2>&1; then
52+
echo "📦 Detected apt. Installing FrankenPHP from DEB repository..."
53+
if [ -n "${SUDO}" ]; then
54+
echo "❗ Enter your password to grant sudo powers for package installation"
55+
${SUDO} -v || true
56+
fi
57+
${SUDO} sh -c 'curl -fsSL https://key.henderkes.com/static-php.gpg -o /usr/share/keyrings/static-php.gpg'
58+
${SUDO} sh -c 'echo "deb [signed-by=/usr/share/keyrings/static-php.gpg] https://deb.henderkes.com/ stable main" > /etc/apt/sources.list.d/static-php.list'
59+
if command -v apt >/dev/null 2>&1; then
60+
${SUDO} apt update
61+
${SUDO} apt -y install frankenphp
62+
else
63+
${SUDO} apt-get update
64+
${SUDO} apt-get -y install frankenphp
65+
fi
66+
echo
67+
echo "🥳 FrankenPHP installed successfully."
68+
echo
69+
echo "⭐ If you like FrankenPHP, please give it a star on GitHub: ${italic}https://github.com/php/frankenphp${normal}"
70+
exit 0
71+
fi
72+
fi
73+
2474
case ${ARCH} in
2575
aarch64)
2676
THE_ARCH_BIN="frankenphp-linux-aarch64"
@@ -63,8 +113,6 @@ if [ -z "${THE_ARCH_BIN}" ]; then
63113
exit 1
64114
fi
65115

66-
SUDO=""
67-
68116
echo "📦 Downloading ${bold}FrankenPHP${normal} for ${OS}${GNU} (${ARCH}):"
69117

70118
# check if $DEST is writable and suppress an error message
@@ -76,20 +124,20 @@ if [ $? -eq 1 ]; then
76124
SUDO="sudo"
77125
fi
78126

79-
if type "curl" >/dev/null 2>&1; then
80-
curl -L --progress-bar "https://github.com/php/frankenphp/releases/latest/download/${THE_ARCH_BIN}" -o "${DEST}"
81-
elif type "wget" >/dev/null 2>&1; then
82-
${SUDO} wget "https://github.com/php/frankenphp/releases/latest/download/${THE_ARCH_BIN}" -O "${DEST}"
83-
else
84-
echo "❗ Please install ${italic}curl${normal} or ${italic}wget${normal} to download FrankenPHP"
85-
exit 1
86-
fi
127+
curl -L --progress-bar "https://github.com/php/frankenphp/releases/latest/download/${THE_ARCH_BIN}" -o "${DEST}"
87128

88129
${SUDO} chmod +x "${DEST}"
130+
# Allow binding to ports 80/443 without running as root (if setcap is available)
131+
if command -v setcap >/dev/null 2>&1; then
132+
${SUDO} setcap 'cap_net_bind_service=+ep' "${DEST}" || true
133+
else
134+
echo "❗ install setcap (e.g. libcap2-bin) to allow FrankenPHP to bind to ports 80/443 without root:"
135+
echo " sudo setcap 'cap_net_bind_service=+ep' \"${DEST}\""
136+
fi
89137

90138
echo
91139
echo "🥳 FrankenPHP downloaded successfully to ${italic}${DEST}${normal}"
92140
echo "🔧 Move the binary to ${italic}/usr/local/bin/${normal} or another directory in your ${italic}PATH${normal} to use it globally:"
93-
echo " ${bold}sudo mv ${DEST} /usr/local/bin/${normal}"
141+
echo " ${bold}sudo mv ${DEST} /usr/local/bin/${normal}"
94142
echo
95143
echo "⭐ If you like FrankenPHP, please give it a star on GitHub: ${italic}https://github.com/php/frankenphp${normal}"

0 commit comments

Comments
 (0)