CentOS7 安装PHP7的swoole扩展:
一、绪
Swoole简介
PHP异步网络通信引擎
最终编译为so文件作为PHP的扩展
准备工作
Linux环境
PHP7 swoole2.1 redis
源码安装PHP7 源码安装swoole
https://www.cnblogs.com/cshaptx4869/p/10395744.html
定时器
swoole_timer_tick 每隔一定时间执行,毫秒
swoole_timer_after 一定时间后执行,毫秒
swoole_timer_clear 清除定时器
异步文件系统IO(4.3版本之前)
swoole_async_readfile 异步读取文件内容
执行顺序:1、先读取文件 2、再执行下码 3、最后执行回调
读取的文件不能超过4M
swoole_async_read
swoole_async_writefile
执行顺序和 readfile 相同
swoole_async_write
异步MySQL客户端
使用场景
请求文章详情页 -> mysql 文章+1 -> 页面数据展示
异步redis
进程
进程就是正在运行的程序的一个实例。
内存
Table
Table一个基于共享内存和锁实现的超高性能,并发数据结构。用于解决多进程/多线程数据共享和同步加锁问题。Atomic
Atomic是Swoole底层提供的原子计数操作类,可以方便整数的无锁原子增减。
协程
二、安装
> wget https://github.com/swoole/swoole-src/archive/v4.3.5.tar.gz
> tar xzvf v4.3.5.tar.gz
> cd swoole-src-4.3.5/
> phpize
> ./configure --with-php-config=/usr/local/php71/bin/php-config --enable-http2 --enable-openssl
> make && make install
> echo 'extension=swoole.so' >> /usr/local/php71/lib/php.ini
> systemctl restart php-fpm.service
如果使用hyperf框架修改php.ini配置文件
swoole.use_shortname = 'Off'
$ php --ri swoole

三、nginx+swoole配置
erver {
root /data/wwwroot/;
server_name local.swoole.com;
location / {
proxy_http_version 1.1;
proxy_set_header Connection "keep-alive";
proxy_set_header X-Real-IP $remote_addr;
if (!-e $request_filename) {
proxy_pass http://127.0.0.1:9501;
}
}
}
#通过读取$request->header['x-real-ip']来获取客户端的真实IP
四、手册
https://toxmc.github.io/swoole-cs.github.io/
demo: https://www.helloweba.net/tag/swoole.html
CentOS7 安装PHP7的swoole扩展:的更多相关文章
- centos7安装PHP7的redis扩展
前言: 在本篇博客中,我将给大家介绍如何在Centos7上安装PHP-Redis扩展,关于如何在Centos上安装redis的,可以参考另外一篇博客:Centos7安装redis 想要在php中操作r ...
- Centos7 安装php7.3 并扩展 MySQL、postgresql
首先是安装需要的扩展文件 yum -y install freetype-devel yum -y install libpng-devel yum -y install libjpeg-devel ...
- CentOS7 安装PHP7的redis扩展:
phpredis-4.2.0.tar.gz:下载:wget https://github.com/phpredis/phpredis/archive/4.2.0.tar.gz $ tar -z ...
- Centos7 安装PHP7版本及php-fpm,redis ,php-redis,hiredis,swoole 扩展安装
============================PHP7.1 ========================================= 1. 更换rpm 源,执行下面两个 rpm - ...
- Centos7安装gearman和php扩展
Centos7安装gearman和php扩展 标签(空格分隔): php,linux gearman所需要的依赖 yum install \ vim \ git \ gcc \ gcc-c++ \ w ...
- centos6下安装php7的memcached扩展
安装php7的memcached扩展 .编译安装libmemcached- wget https://launchpadlibrarian.net/165454254/libmemcached-1.0 ...
- window下安装php7的memcache扩展
安装memcache:http://www.runoob.com/memcached/memcached-connection.html1.4.4 c:\memcached\memcached.exe ...
- php----------linux下安装php的swoole扩展
1.首先你已经安装好了php环境,这里就不介绍php环境的安装了.如果你是编译安装记得将php加入环境变量,以便于方便查看扩展是否安装成功. 2.我安装的php环境缺少了要给东西,详细看下图 如果你没 ...
- CentOS7 安装 PHP7.2
点击查看原文 安装源 安装 EPEL 软件包: $ sudo yum install epel-release 安装 remi 源: $ sudo yum install http://rpms.re ...
随机推荐
- 计算机二级-C语言-程序修改题-190114记录-对整型变量进行取余操作可以取得各个位上的值。
//给定程序中fun函数的功能是:从低位开始取出长整形变量s中奇数位上的数,依次构成一个新的数放在t中.高位仍在高位,低位仍在低位.例如:当s中的数为7654321时,t中的数为7531. //重难点 ...
- java基础数据类型和处理
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSON; import java.io.*; import j ...
- Centos7 将应用添加快捷方式到applications 中以pycham为例[ubuntu]适用
安装版本pycharm-2019.1.3 安装路径:/opt/pycharm-2019.1.3/ vim /usr/share/applications/pycharm.desktop #!/usr/ ...
- MyBatis-Plus学习笔记(3):分页查询
依赖配置可参考:MyBatis-Plus学习笔记(1):环境搭建以及基本的CRUD操作 分页配置 @Configuration public class PlusConfig { @Bean publ ...
- Fluent_Python_Part4面向对象,09-pythonic-obj,Python风格的对象
第四部分第9章,Python风格的对象 这一章接第1章,说明常见的特殊方法实现. 本章包括以下话题: 支持用于生成对象其它表示形式的内置函数(如repr().bytes(),等等) 使用一个类方法实现 ...
- .NET中的字符串(4):字符串 - 特殊的引用类型
字符串驻留 看一下这段代码: 1using System; 2 3namespace Demo4 4{ 5 /**//// <summary> 6 /// String的驻留 7 /// ...
- Maven学习笔记:POM标签大全详解
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...
- ➡️➡️➡️IELTS speaking by simon
目录 p1 课程概述 p2 speaking part1, intro, warm up introduction questions then 4 questions about one topic ...
- Update(Stage4):sparksql:第5节 SparkSQL_出租车利用率分析案例
目录: 1. 业务2. 流程分析3. 数据读取5. 数据清洗6. 行政区信息 6.1. 需求介绍 6.2. 工具介绍 6.3. 具体实现7. 会话统计 导读 本项目是 SparkSQL 阶段的练习项目 ...
- 【PAT甲级】1065 A+B and C (64bit) (20 分)(大数溢出)
题意: 输入三个整数A,B,C(long long范围内),输出是否A+B>C. trick: 测试点2包括溢出的数据,判断一下是否溢出即可. AAAAAccepted code: #defin ...