Home > PHP Framework > Swoole > body text

How to compile and install swoole

Release: 2020-01-13 14:11:39
Original
2348 people have browsed it

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
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template