zoukankan      html  css  js  c++  java
  • [PHP] swoole的安装和简单使用

    1.
    pecl install swoole
    开启http2支持需要的依赖库:apt-get install nghttp2
    开启的几个参数:
    enable sockets supports? [no] : yes
    enable openssl support? [no] : yes
    enable http2 support? [no] : no
    enable mysqlnd support? [no] : yes
    enable postgresql coroutine client support? [no] : no
    enable kernel debug/trace log? (it will degrade performance) [no] : yes
    
    2.
    php -i|grep "php.ini"可以看到php.ini的文件路径
    一般php7以上会有个/etc/php/7.0/mods-available目录,在这里建立swoole.ini比较合适
    写入extension=swoole.so
    
    3.
    在cli环境下,一般在这个目录/etc/php/7.0/cli/conf.d , 建立一个软连接到/etc/php/7.0/mods-available/swoole.ini
    ln -s /etc/php/7.0/mods-available/swoole.ini swoole.ini ,这样是比较规范的了
    
    php -m|grep swoole 检测扩展安装成功
    <?php
    $name="taoshihan";
    swoole_timer_tick(500,function($timerId,$parames)use($name){
            echo $timerId."==".$parames."==".$name."==".date("Y-m-d,H:i:s",time())."
    ";
    },"hello");

    php timer.php 每500毫秒执行一次

  • 相关阅读:
    Es module vs require
    phaser3 画虚线实现
    新的计划
    [转]Boostrap Table的refresh和refreshOptions区别
    Storing Java objects in MySQL blobs
    【转】Ubuntu下搜狗输入法突然无法输入中文
    团队作业六
    团队作业七
    团队作业四
    团队作业三
  • 原文地址:https://www.cnblogs.com/taoshihan/p/10029456.html
Copyright © 2011-2022 走看看