Member-only story

Install PHP Swoole on Ubuntu 20.04.1 LTS

Arthur Pello
2 min readSep 9, 2024

--

Prerequisites

Ubuntu 20.04.1 LTS
PHP 8.2.14
Laravel 9

To integrate Swoole with your Laravel application on your Ubuntu 20.04.1 LTS server, follow the following steps:

Step 1: Install PHP Swoole Extension

  1. Update your package lists
sudo apt update

2. Install PHP-Swoole extension via PECL:
First, install the necessary dependencies for PECL:

sudo apt install php-pear php8.2-dev libbrotli-dev -y

3. Install Swoole

sudo pecl install swoole

4. Enable the Swoole extension in your PHP configuration
After installing, you need to add the following line to your `php.ini` (usually located in `/etc/php/8.2/cli/php.ini`):

extension=swoole

5. Restart PHP-FPM and the Web Server

sudo systemctl restart php8.2-fpm
sudo systemctl restart nginx # If using Nginx

Step 2: Install Laravel Octane

Laravel Octane adds Swoole support to Laravel with minimal friction, enabling you to use your application with Swoole.

--

--

Arthur Pello
Arthur Pello

Written by Arthur Pello

Code whisperer by day, keyboard comedian by night. 🌙 🚀

Responses (2)