PHP7.1安装libevent-devel扩展包失败(CentOS)

kenny534

按照文档中的方法,执行#yum install libevent2-devel -yLoaded plugins: fastestmirror, replace
Loading mirror speeds from cached hostfile
  base: mirrors.aliyun.com
 
epel: mirrors.aliyun.com
  extras: mirrors.aliyun.com
 
updates: mirrors.aliyun.com
No package libevent2-devel available.
Error: Nothing to do
 
而执行:
yum install libevent-devel -y倒是没有报错:
Loaded plugins: fastestmirror, replace
Loading mirror speeds from cached hostfile
  base: mirrors.aliyun.com
 
epel: mirrors.aliyun.com
  extras: mirrors.aliyun.com
 
updates: mirrors.aliyun.com
Package libevent-devel-2.0.21-4.el7.x86_64 already installed and latest version
Nothing to do
 
由于现在使用的是PHP7.1故请问如何安装event扩展依赖的libevent-devel包

5859 2 0
2个回答

智佳思远

Package libevent-devel-2.0.21-4.el7.x86_64 already installed and latest version
Nothing to do
 
意思是已经安装了最新版本,已经安装过了

lllpaw

可以手动编译安装

  1. 安装event 支持库 libevent
    下载
    wget https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz
    解压
    tar zxvf libevent-2.1.11-stable.tar.gz
    cd libevent-2.1.11-stable
    ./configure --prefix=/usr/local/libevent-2.1.11-stable
    make && make install
     
  2. 安装 event
    下载
    wget https://pecl.php.net/get/event-2.5.3.tgz
    解压
    tar zxvf event-2.5.3.tgz
    cd event-2.5.3
    /usr/local/php/bin/phpize
    ./configure --with-php-config=/usr/local/php/bin/php-config --with-event-libevent-dir=/usr/local/libevent-2.1.11-stable
    make && make install
     
  3. 最后在php.ini配置文件中开启 event.so 扩展
    extension=event.so
     
  • kenny534 2019-10-10

    追问一下:如何测试event扩展被调用了,而不再使用框架里的Select.php呢?

年代过于久远,无法发表回答
×
🔝