swoole配置在Linux或ios等類似Unix環境中,Windows環境支援不好。
tar編譯安裝參考:https://www.jianshu.com/p/0c0d19c36ed0
編譯安裝參考:http://www.hu-rong.com/article /323
https://blog.csdn.net/q85795362/article/details/85256206
##安裝swoole的步驟如下:
準備工作:
1、查看linux(這裡以CentOS7.6為例)版本:[root@VM_6_21_centos ~]# cat /etc/redhat-release
[root@VM_6_21_centos ~]# php -v
[root@VM_6_21_centos ~]# php -m
[root@VM_6_21_centos ~]# pwd
[root@VM_6_21_centos ~]# yum install php-devel # 通过php的工具包添加扩展,运行命令:phpize yum install glibc-headers yum install gcc-c++ yum install git # git clone yum -y install nghttp2
php.ini 位置:/usr/local/php/etc/php.ini 或者 whereis php.ini
開始安裝
1、cd 到家目錄,下載swoole[root@VM_6_21_centos ~]# git clone https://github.com/swoole/swoole-src.git [root@VM_6_21_centos ~]# ls [root@VM_6_21_centos ~]# mkdir /usr/local/swoole/
[root@VM_6_21_centos ~]# cp -r /root/swoole-src/. /usr/local/swoole/
[root@VM_6_21_centos ~]# cd /usr/local/swoole/ [root@VM_6_21_centos swoole]# ./configure --with-php-config=/usr/local/php/bin/php-config --enable-sockets --enable-openssl --enable-http2 # 配置 [root@VM_6_21_centos swoole]# make clean && make && sudo make install # 编译安装
[root@VM_6_21_centos ~]# vim /usr/local/php/etc/php.ini 配置: extension =/usr/local/php/lib/php/extensions/no-debug-non-zts-20170718/swoole.so
修改了php配置需要平滑启动php-fpm [root@VM_6_21_centos ~]# ps -aux | grep php-fpm 找到phpfpm 的master process的进程id [root@VM_6_21_centos ~]# kill -SIGUSR2 process_id #实现平滑重启php-fpm
swoole入門教學,歡迎線上學習!
以上是一文了解swoole如何安裝的詳細內容。更多資訊請關注PHP中文網其他相關文章!