PHPWebIM是一款使用PHP+Swoole实现的网页即时聊天工具。
功能特点
全异步非阻塞Server,可以同时支持数百万TCP连接在线
基于websocket+flash_websocket支持所有浏览器/客户端/移动端
支持单聊/群聊/组聊等功能
支持永久保存聊天记录
基于Server PUSH的即时内容更新,登录/登出/状态变更/消息等会内容即时更新
支持发送连接/图片/语音/视频/文件(开发中)
支持Web端直接管理所有在线用户和群组(开发中)
安装swoole扩展
运行将client目录配置到Nginx/Apache的虚拟主机目录中,使client/index.html可访问。 修改client/config.js中,IP和端口为对应的配置。
详细部署说明
1.安装composer(php依赖包工具)
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
注意:如果未将php解释器程序设置为环境变量PATH中,需要设置。因为composer文件第一行为#!/usr/bin/env php,并不能修改。
2.composer install
切换到PHPWebIM项目目录,执行指令composer install,如很慢则
composer install --prefer-dist
3.Ningx/Apache配置(这里未使用swoole_framework提供的Web AppServer)
nginx
server
{
listen 80;
server_name im.swoole.com;
index index.shtml index.html index.htm index.php;
root /path/to/PHPWebIM/client;
location ~ .*.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
access_log /Library/WebServer/nginx/logs/im.swoole.com access;
}
apache
<VirtualHost *:80>
DocumentRoot "path/to/PHPWebIM/client"
ServerName im.swoole.com
AddType application/x-httpd-php .php
<Directory />
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
DirectoryIndex index.php
</Directory>
</VirtualHost>
4.修改配置PHPWebIM/config.php
$config['server'] = array(
'host' => '19.0.3.245',
'port' => '9503',
);
其中server项为WebIM服务器即WebSocket服务器的IP与端口,其他选择项根据具体情况修改5.修改配置PHPWebIM/client/config.js
var webim = {6.启动WebSocket服务器
php PHPWebIM/webim_server.php
7.绑定host与访问聊天窗口
vi /etc/hosts
增加
127.0.0.1 im.swoole.com
友情链接 | 关于我们 | 下载帮助(?) | 联系我们 | 投诉举报
CopyRight © 2010-2023 这里下载 heredown.com , All Rights Reserved 版权所有 蒙ICP备2023006002号-1 蒙公网安备15052402000135
声明: 本站所有软件和文章来自互联网 如有异议 请与本站联系
声明: