Skip to content

Instantly share code, notes, and snippets.

@jingmian
Last active November 22, 2018 15:08
Show Gist options
  • Select an option

  • Save jingmian/ac42e71dc38c48bf312ed1d94c722575 to your computer and use it in GitHub Desktop.

Select an option

Save jingmian/ac42e71dc38c48bf312ed1d94c722575 to your computer and use it in GitHub Desktop.
安装swoole
ubuntu php 5.5.38 要安装 swoole 版本1.9.22
cd swoole
/usr/local/php5.5.38/bin/phpize
./configure --with-php-config=/usr/local/php5.5.38/bin/php-config
./configure --enable-openssl --enable-async-redis --enable-coroutine --with-php-config=/usr/local/php/bin/php-config
make
sudo make install
==========================================================
https://blog.liuguofeng.com/archives/4696
启用 Swoole 的 async-redis 扩展需要安装 hiredis,hiredis 需要 redis
安装 Redis
cd ~
wget http://download.redis.io/releases/redis-5.0.0.tar.gz
tar xzf redis-5.0.0.tar.gz
cd redis-5.0.0
make
安装 hiredis
cd ~
wget https://github.com/redis/hiredis/archive/v0.13.3.zip
unzip v0.13.3.zip
cd hiredis-0.13.3
make -j
sudo make install
sudo ldconfig
=======================================
然后编辑php.ini
extension=swoole.so
针对lnmp1.4版本,不需要指定extension_dir
=======================================================
---------------------
netcat -u 127.0.0.1 9503
//查看占用端口
netstat -apn | grep 9503
//清除9503所有端口
kill -9 $(lsof -i ucp:9503 -t)
//非root用户可能需要执行
kill -9 $(sudo lsof -i tcp:进程号 -t)
UDP服务器与TCP服务器不同,UDP没有连接的概念。启动Server后,客户端无需Connect,直接可以向Server监听的
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment