Skip to content

一个在线聊天室demo,基于PHP SWOOLE,需要SWOOLE拓展的支持

Notifications You must be signed in to change notification settings

kong36088/ChatRoom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChatRoom

本应用是一个在线聊天室。利用了swoole高并发并且异步非阻塞的特点提高了程序的性能。 该应用需要swoole拓展的支持。

安装

安装PHPswoole拓展:pecl install swoole

或到swoole官网获取安装帮助

Demo: 聊天室

运行

开启服务: 将client目录配置到Nginx/Apache的虚拟主机目录中,使index.php可访问。 修改config.php中,IP和端口为对应的配置。

cd /path/to/your/application/
php server.php

Ningx/Apache配置

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>

Docker

利用docker快速搭建项目环境

docker pull kong36088/nginx-php7-swoole

docker run --name chat -p 9501:9501 -p 80:80 -itd kong36088/nginx-php7-swoole bash

我的swoole docker镜像地址:swoole镜像 里面有该镜像的详细使用说明

捐赠

您的支持是对我的最大鼓励! 谢谢你请我吃糖 wechatpay alipay

About

一个在线聊天室demo,基于PHP SWOOLE,需要SWOOLE拓展的支持

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages