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

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool