Install swoole extension and php7swoole extension in php7
I accidentally saw a video tutorial about live broadcast yesterday.
Swoole is mentioned in this article. I believe everyone has heard of this thing (phper for nearly a year), but I have not actually used it, and of course I do not know how to use it (me too ).
Here we will summarize how to install the swoole extension in php7 (drawing on several online technical posts.
My Environment
CentOS Linux release 7.3.1611 (Core)
PHP 7.0.22 (cli) (built: Aug 9 2017 18:23:24) (ETS)
Mysql Ver 15.1 Distrib 5.5.52-MariaDB, for Linux (x86_64) using readline 5.1
Nginx version: nginx/1.10.2
Installation Steps
1. wget-c https://github.com/swoole/swoole-src/archive/v2.0.8.tar.gz // The latest version 2.0.8
2. tar-zxvf v2.0.8.tar.gz // decompress the package and then cd to the compressed directory.
3. At this time, you need to use phpize to generate the compilation file (here we have attached http://www.cnblogs.com/hubing/p/4941692.html's explanation of phpizeis clear ){
The role of phpize can be understood as follows: Detection Environment (the phpize tool is in the php installation directory, based on which phpize corresponds to the current php environment, generate the corresponding configure file based on the php configuration) and create a configure file. You must run phpize in a directory. Then phpize will know which directory your environment is, And the configure file is created under this directory.
}
At this time, I am saving The following error: Can't find PHP headers in/usr/include/php The php-devel package is required for use of this command.
Solution: yum install php70w-devel
4. Run phpize/usr/bin/phpize (remember to run it in the swoole extension directory)
5. Execute./configure
6. make & make install
7. Modify php. ini to add extension = swoole. so.
8. Remember to restart the service.
OK! Execute php-m and you will see swoole added.