Online chat rooms with swoole extensions and PHP development

Source: Internet
Author: User

Official website: http://www.swoole.com/(Installation)

http://www.jianshu.com/p/fedbb9d2d999 (Installation)

Http://www.tuicool.com/articles/qERzyuI (chat room)


First look at the effect:

author of, http://chat.hellosee.cc

I installed it, Http://chat.yyii.info.


Method:

1. Install swoole,


My server environment is oneinstack with one-click Installation ,

the swoole is run as a PHP extension
http://www.swoole.com/
Download the latest, according to the above a simple written:

Installation (root permission ):
Cdswoole
Phpize
./configure
Make
sudo makeinstall
Configure PHP.ini
Extension=swoole.so

To, make, when the error.

swoole/swoole_serialize.c: in the file :

/usr/lib/gcc/i686-redhat-linux/4.4.7/include/emmintrin.h:32:3: error:#error "sse2instruction set not Enabled "

= =

Toss for a long time.

Later, looking again,

https://git.oschina.net/swoole/swoole/tree/v2.0.7

Here are the installation methods. (So the installation program from where to download, as far as possible to see the documents written there, do not patchwork)

    • Install from Source

sudo apt-get install php5-devgit clone HTTPS://GITHUB.COM/SWOOLE/SWOOLE-SRC.GITCD Swoole-srcphpize./configuremake && make Install

One success!



2. Modify the php.ini ,

Add a sentence,extension=swoole.so

phpinfo () See, there are swoole .


command line input php–m, you can see that there are swoole in the list


3. Deployment to the line.

According to this article:

Http://www.tuicool.com/articles/qERzyuI


Chat.yyii.info (This is the chat room I installed)


Attention:

Download, a total of 3 directories, Client,rooms,server,

Then modify the configuration locally and upload it.

Client first build a uploads directory, (not in the downloaded file package)


A. Modification: client/static/js/init.js

var config = {' domain ': ' http://chat.yyii.info ', ' wsserver ': ' ws://106.14.209.3:9501 ',}

B. Re-modification: server/config.inc.php

If write domain name, want to write Http://define ("domain", "http://chat.yyii.info");//define (' Online_dir ', '/mnt/hgfs/swoole/chatroom/ rooms/');d efine (' Online_dir ', '/data/wwwroot/chat.yyii.info/rooms/');


That's a good step.

Put three folders,

All uploaded to Chat.yyii.info,


Then move the files under the client to Chat.yyii.info.

So you can access it.


Requires a firewall to open port 9501.

Open on server, Swoole service, 9501 monitoring


Under Oneinstack, the command is as follows:

Iptables-i INPUT 4-p tcp-m State--state new-m TCP--dport 3306-j ACCEPT

/usr/local/php/bin/php/data/wwwroot/chat.yyii.info/server/hsw_server.php


Set the rooms directory and its subdirectory permissions to 777 to ensure that the directory is writable.

The uploads directory is set to 777 writable.

The same is true if rooms is placed under server. Is that server/config.inc.php also modified accordingly.


That's it!

Visit Http://chat.yyii.info and try it!


If there is any problem, check again,

1. If firewall 9501 is turned on,

/etc/init.d/iptables status

2.swoole Whether the service is turned on, 9501 is listening.

Netstat-ntpl|grep 9501

lsof-i:9501

3. Configuration files, directories are not written to.

4.uploads,rooms no Set 777 permissions


= =

Tip: After modifying the configuration file, restart the Swoole service.

Kill the original service before restarting.

Commands by:

PS Aux|grep server|grep-v grep | awk ' {print $} ' |xargs kill-9

The meaning of this sentence: http://www.hellosee.cc/2016/10/520.html


This sentence, such as Next, a kill good.

PS Aux|grep Server

Killall-9 ID


Re-start:

/usr/local/php/bin/php/data/wwwroot/chat.yyii.info/server/hsw_server.php


OK, no problem!


Chat room http://www.hellosee.cc/

Author's chat room:

http://chat.hellosee.cc


You can also expand your reading:

1190000006052748


Hangzhou Green Olive Recruitment php. (To help a friend forward a bit)


----------  recruit the future great God -----------------------

If you have altruistic heart, willing to help others, willing to share
If you encounter PHP problem, Baidu and asked the other groups still did not get answers

Welcome to join, PHP technical question and answer group, QQ Group: 292626152

Educational developments Help others, you will also get promotion!

In order to cherish everyone's valuable time, please do not chat.

May we help each other and grow together!

Add message code, PHP,AJAX,THINKPHP,YII ...


Online chat rooms with swoole extensions and PHP development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.