search
HomePHP FrameworkSwooleHow to compile and install swoole

How to compile and install swoole

Jan 13, 2020 pm 02:11 PM
swoole

How to compile and install swoole

The Swoole extension is built as a PHP standard extension. Use phpize to generate compilation detection scripts, ./configure to do compilation configuration detection, make to compile, and make install to install.

Please download the releases version of swoole. Pulling the latest code directly from the github trunk may not compile.

If there are no special requirements, please be sure to compile and install the latest version of swoole

If the current user is not root, he may not have write permissions to the PHP installation directory. Sudo or su is required during installation.

If you are directly git pulling the update code on the git branch, you must execute make before recompiling. clean

Before installation, you must ensure that the following software has been installed on the system:

php-7.0 or higher version

gcc-4.8 or higher version

make

autoconf

Download address

https://github.com/swoole/swoole-src/releases

http://pecl.php.net/package/swoole

http://git.oschina.net/swoole/swoole

Compilation example for novices:

cd swoole
phpize (ubuntu 没有安装phpize可执行命令:sudo apt-get install php-dev来安装phpize)
./configure
make 
sudo make install

Advanced complete compilation example:

The following script will download and compile the source code of the master branch. You need to ensure that you have installed all dependencies, otherwise you will encounter various dependency errors

mkdir -p ~/build && \
cd ~/build && \
rm -rf ./swoole-src && \
curl -o ./tmp/swoole.tar.gz https://github.com/swoole/swoole-src/archive/master.tar.gz -L && \
tar zxvf ./tmp/swoole.tar.gz && \
mv swoole-src* swoole-src && \
cd swoole-src && \
phpize && \
./configure \
--enable-coroutine \
--enable-openssl  \
--enable-http2  \
--enable-async-redis \
--enable-sockets \
--enable-mysqlnd && \
make clean && make && sudo make install

After successful compilation and installation, modify php.ini and add

extension=swoole.so

Use php -m or phpinfo() to check whether swoole.so is successfully loaded. , if not, it may be that the path of php.ini is wrong, you can use php --ini to locate the absolute path of php.ini.

Recommended learning: swoole tutorial

The above is the detailed content of How to compile and install swoole. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How can I contribute to the Swoole open-source project?How can I contribute to the Swoole open-source project?Mar 18, 2025 pm 03:58 PM

The article outlines ways to contribute to the Swoole project, including reporting bugs, submitting features, coding, and improving documentation. It discusses required skills and steps for beginners to start contributing, and how to find pressing is

How do I extend Swoole with custom modules?How do I extend Swoole with custom modules?Mar 18, 2025 pm 03:57 PM

Article discusses extending Swoole with custom modules, detailing steps, best practices, and troubleshooting. Main focus is enhancing functionality and integration.

How do I use Swoole's asynchronous I/O features?How do I use Swoole's asynchronous I/O features?Mar 18, 2025 pm 03:56 PM

The article discusses using Swoole's asynchronous I/O features in PHP for high-performance applications. It covers installation, server setup, and optimization strategies.Word count: 159

How do I configure Swoole's process isolation?How do I configure Swoole's process isolation?Mar 18, 2025 pm 03:55 PM

Article discusses configuring Swoole's process isolation, its benefits like improved stability and security, and troubleshooting methods.Character count: 159

How does Swoole's reactor model work under the hood?How does Swoole's reactor model work under the hood?Mar 18, 2025 pm 03:54 PM

Swoole's reactor model uses an event-driven, non-blocking I/O architecture to efficiently manage high-concurrency scenarios, optimizing performance through various techniques.(159 characters)

How do I troubleshoot connection issues in Swoole?How do I troubleshoot connection issues in Swoole?Mar 18, 2025 pm 03:53 PM

Article discusses troubleshooting, causes, monitoring, and prevention of connection issues in Swoole, a PHP framework.

What tools can I use to monitor Swoole's performance?What tools can I use to monitor Swoole's performance?Mar 18, 2025 pm 03:52 PM

The article discusses tools and best practices for monitoring and optimizing Swoole's performance, and troubleshooting methods for performance issues.

How do I resolve memory leaks in Swoole applications?How do I resolve memory leaks in Swoole applications?Mar 18, 2025 pm 03:51 PM

Abstract: The article discusses resolving memory leaks in Swoole applications through identification, isolation, and fixing, emphasizing common causes like improper resource management and unmanaged coroutines. Tools like Swoole Tracker and Valgrind

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool