Latest version: pecl install openswoole-22.1.2 | composer require openswoole/core:22.1.5

General Requirements

  1. Linux, FreeBSD or MacOS (OS X), Cygwin, WSL
  2. Linux kernel version >= 2.3.32
  3. For Windows there is Docker and WSL (Windows Subsystem for Linux)
  4. PHP version >= 7.4.0
  5. GCC version >= 4.8
  6. PHP Composer

Recommend Linux version: Ubuntu 16, CentOS 7 or greater

PHP Version Dependency

  1. OpenSwoole only supports PHP version >= 7.4.0, PHP 8.0+ is recommended
  2. OpenSwoole doesn't depend on the PHP extensions like stream, sockets, pcntl, posix, sysvmsg, etc. You simply need to install the basic extensions for core PHP
  3. OpenSwoole always aims to support the latest version of PHP, it is best to always make sure you have a supported version of PHP installed, check PHP Supported Versions to find out

OpenSwoole supports PHP 8.0 and PHP JIT

Update your System

Before we start it is best to make sure your system has the latest updates and packages.

For Ubuntu/Debian this is easy, run the following commands:

sudo apt-get update && sudo apt-get upgrade

For CentOS and RedHat systems etc. check online guides on how to update your OS.

Linux Systems Requirements

On Linux if you are installing OpenSwoole via PECL or the PHP PPA Repository (Deb.Sury) or compiling, you will need the following requirements/packages below.

PHP Language Core

You should have PHP installed first, refer to the PHP manual for this; in general though PHP can be installed by compiling PHP directly or via your Unix like package installation system, for example on Ubuntu/Debian:

PHP via Default Package on System


# Update your server
$ sudo apt-get update && sudo apt-get upgrade

# Install default PHP package
$ sudo apt-get install php

# Check installed version and info
$ php -v

PHP Installation Complete

When we check our PHP install with $ php -v you will see something like:

PHP 7.4.3 (cli) (built: Oct  6 2020 15:47:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

PECL & Compiling From Source

When using PHP PECL or cloning the OpenSwoole source to compile manually, you will need to meet the following requirements on Linux:


# Install the GCC Compiler
sudo apt install gcc

# Required for PECL installation and manual OpenSwoole compilation
$ sudo apt install php-dev

# Main requirements for OpenSwoole and useful packages
$ sudo apt install openssl
$ sudo apt install libssl-dev
$ sudo apt install curl
$ sudo apt install libcurl4-openssl-dev
$ sudo apt install libpcre3-dev
$ sudo apt install build-essential

PHP Extensions

If you plan on using CURL or MySQL with OpenSwoole, you need to have the compatible PHP extensions installed as well, check the example below for which extensions you may need.

You should change the PHP version to what you have installed.


# Recommended PHP Extensions
sudo apt install php7.4-curl \
                 php7.4-json \
                 php7.4-mysql \

# Useful PHP Extensions
sudo apt install php7.4-bcmath \
                 php7.4-gd \
                 php7.4-intl \
                 php7.4-mbstring \
                 php7.4-opcache \
                 php7.4-xml \

OpenSwoole Core

You have to install OpenSwoole Core composer library to access to a few features such as Psr support and addon functions implemented with PHP:


composer require openswoole/core


For MacOS you can use brew to install PHP and then follow along with the Linux Requirements.

Once you have all the general and linux dependencies you can then install OpenSwoole on OS X systems.

After you have completed the prerequisites guide you can move onto installing OpenSwoole

Last updated on September 20, 2022