How to Install and Use the glibc‑Based swoole‑cli on Ubuntu, Debian, and Fedora
This guide explains the limitations of the static swoole‑cli build, introduces the new glibc‑linked version in v6.1.3, and provides step‑by‑step commands for installing the .deb or .rpm packages, running PHP‑FPM, starting the CLI HTTP server, using Composer, and loading additional PHP extensions.
The previous static build of swoole-cli linked all libraries statically, which avoided runtime dependencies but could not load dynamic PHP extensions (e.g., opcache, phpy) and used musl libc, resulting in slower memory allocation than glibc.
glibc‑linked release
Version v6.1.3 provides a glibc‑linked distribution. The official download page contains two packages: swoole-cli-v6.1.3-linux-x64-glibc.deb – for Debian/Ubuntu. swoole-cli-v6.1.3-linux-x64-glibc.rpm – for RHEL/Fedora/CentOS.
Ubuntu/Debian installation
Requires Ubuntu 22.04 or Debian 12.
Inside a Docker container (or on a bare system) install the .deb without updating package lists:
sudo docker run -it -v /home/swoole/workspace/projects/swoole-cli/:/work ubuntu:22.04
apt install ./swoole-cli-v6.1.3-linux-x64-glibc.debThe binary is placed at /usr/local/bin/swoole-cli and its bundled shared libraries are stored under /usr/local/swoole-cli/lib/. The library directory contains a full set of .so files (e.g., libssl.so, libcurl.so, libstdc++.so) that are used instead of the host system’s versions, making the binary behave similarly to a self‑contained Docker image.
RHEL/Fedora installation
For Fedora 36 or newer, install the .rpm package:
sudo docker run -it -v /home/swoole/workspace/projects/swoole-cli/:/work fedora:36
yum install ./swoole-cli-v6.1.3-linux-x64-glibc.rpmRunning PHP‑FPM
swoole-cli -P -h
# Shows usage options such as -c <code><path></code>, -n, -d foo[=bar], -i, -m, -v, etc.Starting the built‑in HTTP server
swoole-cli -S 127.0.0.1:9903
# Starts a PHP development server at http://127.0.0.1:9903Using Composer inside the container
swoole-cli composer
# Displays Composer help and available commands.Viewing loaded extensions
The extension list of the glibc build matches that of the static build:
swoole-cli -m
# Outputs a long list of PHP modules, including bcmath, curl, gd, imagick, opcache, openssl, redis, swoole, etc.Dynamic extension loading
swoole-clidoes not bundle phpize, so a separate PHP 8.4 ZTS NO‑DEBUG development environment with gcc, make, autoconf, etc., is required to compile extensions. After building, copy the resulting .so files to the PHP extensions directory: /usr/lib/php/extensions/no-debug-zts-20240924 Load an extension at runtime, for example:
swoole-cli -d extension=phpy -vVersion check
swoole-cli -v
# Swoole 6.1.3 (cli) (built: Nov 26 2025 ...) (ZTS)Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Open Source Tech Hub
Sharing cutting-edge internet technologies and practical AI resources.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
