当前位置:网站首页>Swoole学习(一)
Swoole学习(一)
2022-08-04 05:25:00 【eleven_-11】
php现有的应用方式都是基于http的,对于需要快速实时响应的情况比较乏力,在一些推送服务类型的需要和服务端保持一个长期tcp连接以便于实时响应和推送信息。swoole就是解决这样的应用场景的。
学习swoole需要的基础
- 熟练掌握php
- 具备linux基础
- 理解 TCP HTTP SOCKET WebSocket, 点击参阅
编译Swoole
这里是在原有的php7.2增加Swoole4.4.0扩展
php7.2的编译以及LNMP的搭建点击参阅
根据php版本获取对应的swoole源码进行编译,快速通道
先说下思路:下载Swoole源码 > 使用phpize工具生成Swoole配置文件(下载的源码是没有configure文件的,需要使用phpize进行生成) > 配置Swoole与当前php版本相对应的程序 > 执行编译 > php引入编译好的Swoole扩展
PS:其实phpize是一个运行脚本,主要作用是检测php的环境还有就是在特定的目录生成相应的configure文件,这样make install之后,生成的.so文件才会自动加载到php扩展目录下面
一、cd 到swoole源码目录下
二、然后找到php7.2的安装目录,找到bin目录里面的phpize的位置,我的是在这里
三、然后在Swoole目录执行以下命令,用来生成Swoole编译安装的configure文件/usr/local/php7.2/bin/phpize
四、有了configure文件之后,接着配置与当前php版本相符的Swoole扩展,Swoole目录里面执行以下命令./configure --with-php-config=/usr/local/php7.2/bin/php-config
五、完了之后,接着执行编译:makemake install

即编译成功
六、在php的配置文件中添加swoole扩展
找到配置文件路径,若为空,则从php源码将php.ini-development复制到配置文件存在路径(Configuration File (php.ini) Path对应参数)为php.ini
在php.ini最后添加extension=swoole.so(swoole.so路径)
执行php -m
即添加成功
边栏推荐
- C Expert Programming Chapter 5 Thinking about Linking 5.3 5 Special Secrets of Library Linking
- 力扣:509. 斐波那契数
- The string class introduction
- static在不同位置定义变量居然还有不同的含义?
- el-Select selector bottom fixed
- 嵌入式系统驱动初级【4】——字符设备驱动基础下_并发控制
- 编程大杂烩(四)
- Unity开发类似Profile那样的数据分析工具
- leetcode 12. Integer to Roman numeral
- The cost of automated testing is high and the effect is poor, so what is the significance of automated testing?
猜你喜欢
随机推荐
9、动态SQL
12、分页插件
Unity表格配置编辑工具
4.1 声明式事务之JdbcTemplate
4.1 JdbcTemplate for declarative transactions
C Expert Programming Chapter 4 The Shocking Fact: Arrays and pointers are not the same 4.2 Why does my code not work
The symbol table
CentOS7 - yum install mysql
Do you think border-radius is just rounded corners?【Various angles】
[Cocos 3.5.2]开启模型合批
Canal mysql data synchronization
Write golang simple C2 remote control based on gRPC
About yolo7 and gpu
[One step in place] Jenkins installation, deployment, startup (complete tutorial)
Unity DOTS学习教程汇总
4.3 Annotation-based declarative transactions and XML-based declarative transactions
高性能高可靠性高扩展性分布式防火墙架构
MySQL数据库面试题总结(2022最新版)
LCP 17. Quick Calculation Robot
As soon as flink cdc is started, the CPU of the source Oracle server soars to more than 80%. What is the reason?









