阿里云服务器 ubuntu 12.4 安装workerman与3个简单开发实例测试
2016-09-05 10:15
417 查看
参考:http://doc3.workerman.net/getting-started/simple-example.html
1.apt-get install php5-cli git gcc php-pear php5-dev libevent-dev -y
2.pecl install event 安装过程出现问题
root@iZ252f8y3biZ:/# pecl install event
pecl/event requires PHP (version >= 5.4.0), installed version is 5.3.10-1ubuntu3.24
No valid packages found
install failed
3.git clone https://github.com/walkor/Workerman
4.创建http_test.php文件编写测试代码,将文件放到/var/www
运行命令:php /var/www/http_test.php start
Workerman[/var/www/http_test.php] start in DEBUG mode
----------------------- WORKERMAN -----------------------------
Workerman version:3.3.4 PHP version:5.3.10-1ubuntu3.24
------------------------ WORKERS -------------------------------
user worker listen processes status
root none http://0.0.0.0:2345 4 [OK]
----------------------------------------------------------------
Press Ctrl-C to quit. Start success.
在浏览器输入云服务器的公网ip以及端口号:http://123.56.29.115:2345/
返回:helloworld 说明配置成功
5.在ws_test.php使用时客户端,新建html文件:
<html>
<title></title>
<head>
<script>ws = new WebSocket("ws://123.56.29.115:2346");
ws.onopen = function() {
alert("连接成功");
ws.send('tom');
alert("给服务端发送一个字符串:tom");
};
ws.onmessage = function(e) {
alert("收到服务端的消息:" + e.data);
};
</script>
</head>
<body></body>
</html>
可以看到网页弹出框有提示说明正常连接
6.新建tcp_test.php 运行,通过tcp232-test软件:选择tcp客户端连接公网ip与端口号2347,连接成功之后发送可以收到服务器端返回来的数据
1.apt-get install php5-cli git gcc php-pear php5-dev libevent-dev -y
2.pecl install event 安装过程出现问题
root@iZ252f8y3biZ:/# pecl install event
pecl/event requires PHP (version >= 5.4.0), installed version is 5.3.10-1ubuntu3.24
No valid packages found
install failed
3.git clone https://github.com/walkor/Workerman
4.创建http_test.php文件编写测试代码,将文件放到/var/www
运行命令:php /var/www/http_test.php start
Workerman[/var/www/http_test.php] start in DEBUG mode
----------------------- WORKERMAN -----------------------------
Workerman version:3.3.4 PHP version:5.3.10-1ubuntu3.24
------------------------ WORKERS -------------------------------
user worker listen processes status
root none http://0.0.0.0:2345 4 [OK]
----------------------------------------------------------------
Press Ctrl-C to quit. Start success.
在浏览器输入云服务器的公网ip以及端口号:http://123.56.29.115:2345/
返回:helloworld 说明配置成功
5.在ws_test.php使用时客户端,新建html文件:
<html>
<title></title>
<head>
<script>ws = new WebSocket("ws://123.56.29.115:2346");
ws.onopen = function() {
alert("连接成功");
ws.send('tom');
alert("给服务端发送一个字符串:tom");
};
ws.onmessage = function(e) {
alert("收到服务端的消息:" + e.data);
};
</script>
</head>
<body></body>
</html>
可以看到网页弹出框有提示说明正常连接
6.新建tcp_test.php 运行,通过tcp232-test软件:选择tcp客户端连接公网ip与端口号2347,连接成功之后发送可以收到服务器端返回来的数据
相关文章推荐
- 游戏服务器开发--阿里云Ubuntu 安装mysql
- linux 下 VNC Server安装配置及 eclipse CDT C/C++ 开发环境搭建(我用的是阿里云服务器 ubuntu 12.04 64-bit,无图形化界面)
- 阿里云学生服务器搭建网站(2)-Ubuntu16.04安装php开发环境
- nagios 监控Linux和Unix服务器(ubuntu服务器安装实例)
- nagios 监控Linux和Unix服务器(ubuntu服务器安装实例)
- 阿里云linux服务器下安装Apache的简单方法
- 如何在Ubuntu下搭建tftp服务器(最简单的安装配置)
- Ubuntu下安装ACE和ACE简单程序及其测试
- ftp 服务器——bftpd 在 ubuntu 上的安装和简单配置
- 如何在Ubuntu下搭建tftp服务器(最简单的安装配置)
- [FirefoxOS_开发环境]Linux和Ubuntu环境下B2G(Firefox OS)安装、编译、测试教程集合
- 阿里云服务器【ubuntu】Tomcat安装
- debian下OpenCV安装 + 简单测试实例
- Ubuntu_安装 Qt 开发环境 简单实现
- 阿里云服务器【ubuntu】安装jdk
- ubuntu中安装apache ab命令进行简单压力测试
- Ubuntu 安装mysql,以及使用C++开发简单示例
- 阿里云Ubuntu12服务器安装apache2.44
- 阿里云服务器【ubuntu】Tomcat安装