Home >Backend Development >PHP Problem >How to install swoole extension in php
1. Installation
# wget https://github.com/swoole/swoole-src/archive/swoole-1.7.6-stable.tar.gz
# tar zxvf swoole-1.7.6-stable.tar.gz # cd swoole-1.7.6-stable # phpize # ./configure # make && make install**
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
./configure --enable-debug --with-php-config=这里放入上一步命令中显示的绝对路径
2. PHP loads the swoole extension
php -i | grep php.ini
Query the path where php.ini is located Enter the path and add extension=swoole.so
to php.ini.
3. Restart the service
service php-fpm restart service nginx restart
4. Test
View the phpinfo information, as shown below:
## 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!