zoukankan      html  css  js  c++  java
  • Centos7 安装多版本php 并添加swoole拓展

    服务器默认安装了php7

    直接使用lnmp工具包安装php5.6

    使用之前的lnmp安装包,切换到root 

    sudo su -

    运行

    选择5.6

    安装完成

    没有安装swoole拓展

    由官方https://github.com/swoole/swoole-src介绍

    php5.6需要安装swoole1.x

    获取swoole代码

    git clone https://github.com/swoole/swoole-src.git
    cd swoole-src
    切换到
    git checkout v1.9.3-stable

    先phpize

    configure

    完成后

    make && make install

    编译完成

    修改php5.6 的 php.ini加入

    extension=swoole.so

    安装完成

    测试

    新建swooletest.php

    <?php
    $server = new SwooleHttpServer('127.0.0.1', 9501);
    
    $server->on('Request', function($request, $response) {
        $tcp_cli = new SwooleCoroutineClient(SWOOLE_SOCK_TCP);
        $tcp_cli->connect('127.0.0.1', 9906);
        $tcp_cli->send('test for the coroutine');
        $ret = $tcp_cli->recv(5);
        $tcp_cli->close();
    
        if ($ret) {
            $response->end(' swoole response is ok');
        }
        else{
            $response->end(" recv failed error : {$client->errCode}");
        }
    });
    
    $server->start();
    

      启动测试

    /usr/local/php5.6/bin/php swooletest.php

    查看端口:

    php5.6swoole 拓展安装完成

    php7直接执行

    pecl install swoole

     

  • 相关阅读:
    pygame--颜色变化
    pyQt绘图
    pyqt布局管理器
    java执行shell/cmd命令
    word公式编辑器公式
    pygame绘制文本
    2.add two number
    eltwise层
    crop层
    fcn
  • 原文地址:https://www.cnblogs.com/timseng/p/9917286.html
Copyright © 2011-2022 走看看