# myserver **Repository Path**: chenwifi/myserver ## Basic Information - **Project Name**: myserver - **Description**: 一个基于Linux的模仿swoole v1.10.6的php扩展 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 0 - **Created**: 2022-01-22 - **Last Updated**: 2022-07-05 ## Categories & Tags **Categories**: Uncategorized **Tags**: PHP, Swoole, Linux ## README # myserver #### 介绍 一个基于Linux的模仿swoole v1.10.6的php扩展 相对于swoole v1.10.6,只具备最基本的功能,并且不考虑buffer,只是直接写或读,因此会出现数据丢失的可能性。 简单来说,就是一个异步tcp服务器。 #### 安装教程 与普通的php扩展安装一样: 1. 下载源码 2. /phpbinpath/phpize 3. ./configure --enable-debug --with-php-config=/root/phpdebug/bin/php-config (--enable-debug可选,用于调试) 4. make && make install #### 使用说明 1. 示例: ![使用实例](https://images.gitee.com/uploads/images/2022/0424/113312_fa3e4506_1927662.png "屏幕截图.png") 2. 效果: 默认打开进程数和线程数是cpu个数,你可以通过myserver_server类的set函数更改设置(目前set函数仅支持这两个更改) ![查看进程](%E6%8D%95%E8%8E%B7.PNG) 可以看到当前一个master进程,一个manager进程和一个worker进程 3. 功能: - 打开telnet客户端: ![telnet客户端](image.png) - 发送数据 ![发送数据](send%20data.png) - 查看结果(因为我们示例实现的是一个简单的回显功能,所以应该收到同样的数据) ![查看结果](receive.png) - 重启worker进程(非平滑重启) ![输入图片说明](reload.png) - 关闭服务 ![输入图片说明](shutdown.png)