zoukankan      html  css  js  c++  java
  • Linux 安装Swoole

    Linux 安装Swoole

    练习环境:

      虚拟机:Oracle VM VirtualBox 5.2.4 r119785 (Qt5.6.2)。

      系统:CentOS Linux release 7.6.1810 (Core)   x86_64-Minimal版。


     (1)建立一个目录放swoole的安装文件

    cd /data
    mkdir rpm

    (2)打开swoole的github地址:https://github.com/swoole/swoole-src/releases

    (3)找到需要的版本,例如4.3.4,下载:

    wget -c https://github.com/swoole/swoole-src/archive/v4.3.4.tar.gz

    (4)解压:

    tar -xzvf v4.3.4.tar.gz

    (5)检查一下环境和依赖要求,查看swoole官网:https://wiki.swoole.com/。

      查看依赖,https://wiki.swoole.com/wiki/page/7.html。
      查看编译安装的准备:https://wiki.swoole.com/wiki/page/6.html。
      安装前必须保证系统已经安装了下列软件
        php-7.0 或更高版本
        gcc-4.8 或更高版本
        make
        autoconf
        pcre (CentOS系统可以执行命令:yum install pcre-devel)

      检查命令:
      php -v 查看php版本
      gcc -v 查看gcc版本
      rpm -qa make 检查是否安装make。
      rpm -qa autoconf 检查是否安装autoconf。
      rpm -qa pcre 检查是否安装pcre。

    (6)配置编译:

    phpize && 
    ./configure
    --enable-coroutine 
    --enable-openssl 
    --enable-http2 
    --enable-async-redis 
    --enable-sockets 
    --enable-mysqlnd && 
    make clean && make

      如果报错:

        configure: error: Cannot find php-config. Please use --with-php-config=PATH

        找到php的目录,找到php-config的位置,例如:

    phpize && 
    ./configure --with-php-config=/usr/local/php/bin/php-config 
    --enable-coroutine 
    --enable-openssl 
    --enable-http2 
    --enable-async-redis 
    --enable-sockets 
    --enable-mysqlnd && 
    make clean && make

    (7)安装:

    make install

    (8)php添加swoole扩展

      使用php --ini查看php.ini的位置,执行结果示例:
        Configuration File (php.ini) Path: /usr/local/php/etc
        Loaded Configuration File: /usr/local/php/etc/php.ini
        Scan for additional .ini files in: /usr/local/php/conf.d
        Additional .ini files parsed: (none)
      编辑php.ini
      vim /usr/local/php/etc/php.ini
      添加:
        extension=swoole.so
      保存退出。

    (9)验证是否安装成功  

    php --ri swoole

    查看版本:

    php --ri swoole | grep Version

    可以看到已安装成功。

  • 相关阅读:
    程序员下班去超市购物与收银员的一段搞笑对白 续集
    2010年9月02日周四_Deploying ArcGIS Mobile applications_4.1
    2010年8月30日周一_Adding layers _7.2
    2010年8月30日周一_Creating A Map_7.1
    2010年9月01日周三_CreatingAndPublishingaMobileWebService_3.2
    2010年8月29日周日_Deployment_6
    2010年8月31日周二_Navigating the map_7.3
    2010年8月30日周一_Introduction to ArcGIS Mobile SDK_1
    2010年9月01日周三_Using GPS data and devices_3.3
    2010年8月29日周日_Using the Sample Xcode Projects_5
  • 原文地址:https://www.cnblogs.com/gyfluck/p/11275114.html
Copyright © 2011-2022 走看看