
swoole 要安装redis扩展吗
1个回答
2017-03-06
展开全部
swoole扩展是PHP扩展。php swoole扩展,PHP语言的高性能网络通信框架,提供了PHP语言的异步多线程服务器,异步TCP/UDP网络客户端,异步MySQL,数据库连接池,AsyncTask,消息队列,毫秒定时器,异步文件读写,异步DNS查询。
1、下载swoole源码包
[root@nginx ~]# wgetwoole-1.7.17-stable
2、解压进入swoole文件夹
[root@nginx ~]# tar -zxvf swoole-1.7.17-stable[root@nginx ~]# cd swoole-src-swoole-1.7.17-stable/
3、编译安装swoole
[root@nginx swoole-src-swoole-1.7.17-stable]# phpize[root@nginx swoole-src-swoole-1.7.17-stable]# ./configure[root@nginx swoole-src-swoole-1.7.17-stable]# make && make install
4、php.ini配置文件加载swoole.so模块
[root@nginx swoole-src-swoole-1.7.17-stable]# vi /usr/local/php/lib/php.ini
注意 php命令行运行和浏览器运行的配置文件不一样。
php 命令行的配置:
[root@nginx swoole-src-swoole-1.7.17-stable]# php --iniConfiguration File (php.ini) Path: /usr/local/libLoaded Configuration File: /usr/local/lib/php.ini//配置文件Scan for additional .ini files in: (none)Additional .ini files parsed: (none)
5、查看swoole模块是否已经安装成功
[root@nginx swoole-src-swoole-1.7.17-stable]# php -m
6、编写服务端httpServer.php文件并运行
$serv = new swoole_server("127.0.0.1", 9501);$serv->on('connect', function ($serv, $fd){echo "Client:Connect.\n";});$serv->on('receive', function ($serv, $fd, $from_id, $data) {$serv->send($fd, 'Swoole: '.$data);});$serv->on('close', function ($serv, $fd) {echo "Client: Close.\n";});$serv->start();
运行httpServer.php
[root@nginx swoole-src-swoole-1.7.17-stable]# php httpServer.php
7、用telnet测试
[root@nginx ~]# telnet 127.0.0.1 9501Trying 127.0.0.1...Connected to 127.0.0.1.Escape character is '^]'.hello 客户端Swoole: hello 服务端
1、下载swoole源码包
[root@nginx ~]# wgetwoole-1.7.17-stable
2、解压进入swoole文件夹
[root@nginx ~]# tar -zxvf swoole-1.7.17-stable[root@nginx ~]# cd swoole-src-swoole-1.7.17-stable/
3、编译安装swoole
[root@nginx swoole-src-swoole-1.7.17-stable]# phpize[root@nginx swoole-src-swoole-1.7.17-stable]# ./configure[root@nginx swoole-src-swoole-1.7.17-stable]# make && make install
4、php.ini配置文件加载swoole.so模块
[root@nginx swoole-src-swoole-1.7.17-stable]# vi /usr/local/php/lib/php.ini
注意 php命令行运行和浏览器运行的配置文件不一样。
php 命令行的配置:
[root@nginx swoole-src-swoole-1.7.17-stable]# php --iniConfiguration File (php.ini) Path: /usr/local/libLoaded Configuration File: /usr/local/lib/php.ini//配置文件Scan for additional .ini files in: (none)Additional .ini files parsed: (none)
5、查看swoole模块是否已经安装成功
[root@nginx swoole-src-swoole-1.7.17-stable]# php -m
6、编写服务端httpServer.php文件并运行
$serv = new swoole_server("127.0.0.1", 9501);$serv->on('connect', function ($serv, $fd){echo "Client:Connect.\n";});$serv->on('receive', function ($serv, $fd, $from_id, $data) {$serv->send($fd, 'Swoole: '.$data);});$serv->on('close', function ($serv, $fd) {echo "Client: Close.\n";});$serv->start();
运行httpServer.php
[root@nginx swoole-src-swoole-1.7.17-stable]# php httpServer.php
7、用telnet测试
[root@nginx ~]# telnet 127.0.0.1 9501Trying 127.0.0.1...Connected to 127.0.0.1.Escape character is '^]'.hello 客户端Swoole: hello 服务端
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询