zoukankan      html  css  js  c++  java
  • PHP7 学习笔记(五)安装event扩展(libevent)

    一、描述:有效安排I/O,时间和信号的扩展 使用可用于特定平台的最佳I/O通知机制的事件,是PHP基础设施的libevent端口。

    二、下载地址:http://pecl.php.net/package/event

    三、安装支持库libevent,需要编译高版本(这里以最新版本release-2.1.8-stable为例)

    1、下载地址:https://github.com/nmathewson/Libevent.git

    git clone https://github.com/nmathewson/Libevent.git

    2、注意:如果您从git存储库获取libevent,则首先需要运行包含的“autogen.sh”脚本以生成configure脚本。

    cd Libevent/
    ./autogen.sh

    3、可能会提示错误信息:

    configure.ac:129: error: possibly undefined macro: AC_PROG_LIBTOOL
          If this token and others are legitimate, please use m4_pattern_allow.
          See the Autoconf documentation.
    autoreconf: /usr/bin/autoconf failed with exit status: 1

    解决办法:

    sudo apt-get install libtool

    4、生成 Makefile,同时指定安装路径,为下一步的编译做准备

    ./configure --prefix=/usr/local/libevent-2.1.8
    make
    sudo make install

    四、安装event库(以event-2.3.0.tgz为例)

    1、官方地址:http://pecl.php.net/package/event

    2、下载解压

    wget http://pecl.php.net/get/event-2.3.0.tgz
    tar -zxvf event-2.3.0.tgz

    3、查找对应的phpize

    /usr/local/php-7.1.8/bin/phpize

    查找配置文件:

    www@Tinywan:~/DEMO/event-2.3.0$ sudo find / -name php-config
    /usr/local/php-7.1.8/bin/php-config

    4、生成 Makefile,同时指定安装路径,为下一步的编译做准备

    ./configure --with-php-config=/usr/local/php-7.1.8/bin/php-config --with-event-libevent-dir=/usr/local/libevent-2.1.8/

    5、编译安装,重启服务器

    make
    sudo make install

    6、修改配置文件php.ini,添加以下内容

    extension=/usr/local/php-7.1.8/lib/php/extensions/no-debug-non-zts-20160303/event.so

    7、重启服务器,查看扩展是否安装成功

    sudo systemctl restart php-fpm.service
    php -m
    php -m | grep event

    8、结束

     

  • 相关阅读:
    计蒜客38228 Max answer 单调栈 + 线段树
    Codeforces 103D Time to Raid Cowavans 分块
    Poj 2352 Stars
    HDU 6203 ping ping ping LCA + 贪心
    redis——数据库发展
    数据库拆分
    java基础算法
    docker部署redis集群
    docker网络
    DockerFile
  • 原文地址:https://www.cnblogs.com/tinywan/p/7551533.html
Copyright © 2011-2022 走看看