Home > Backend Development > PHP Problem > How to install swoole extension in php

How to install swoole extension in php

王林
Release: 2023-02-28 16:52:02
Original
4131 people have browsed it

How to install swoole extension in php

1. Installation

# wget https://github.com/swoole/swoole-src/archive/swoole-1.7.6-stable.tar.gz
Copy after login
# tar zxvf swoole-1.7.6-stable.tar.gz
# cd swoole-1.7.6-stable 
# phpize 
# ./configure 
# make  && make install**
Copy after login

Tips:

Sometimes we generate PHP extension modules After restarting, you will find that phpinfo is not loaded successfully. This is because the compiled version of swoole does not have debug mode, and the current version of our php installation has debug mode, so we only need to recompile swoole and php, and add --enable-debug when recompiling swoole is enough.

 find / -name php-config
Copy after login
./configure --enable-debug --with-php-config=这里放入上一步命令中显示的绝对路径
Copy after login

2. PHP loads the swoole extension

php -i | grep php.ini
Copy after login

Query the path where php.ini is located Enter the path and add extension=swoole.so to php.ini.

How to install swoole extension in php

3. Restart the service

service php-fpm restart 
service nginx restart
Copy after login

4. Test

View the phpinfo information, as shown below:

How to install swoole extension in php

## Recommended related article tutorials:

Getting started with php development

The above is the detailed content of How to install swoole extension in php. 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