php 扩展编译 libevent、event

php 扩展编译 libevent、event

  • 需要先编译安装好php 、openssl
    php安装在了/opt/php
    openssl安装在了/opt/openssl
libevent
  • ** 注意:** 此源码包编译出的libevent不是PHP的扩展库,其安装后的libevent.so只是一个链接文件。
  • 下载libevent源码包,并解压
    tar -zxvf libevent-2.1.12-stable
  • 执行配置
    cd libevent-2.1.12-stable
    ./configure --prefix=/opt/libevent
  • 编译&安装
    make
    make install
  • ./configure出现的错误及解决方法
    1、openssl is a must but can not be found. You should add the directory containing openssl.pc' to thePKG_CONFIG_PATH’ environment variable, or set CFLAGS' andLDFLAGS’ directly for openssl, or use `–disable-openssl’ to disable support for openssl encryption
    解决方法:
 不能在./configure时设置 --disable-openssl参数,否则会在event配置时缺少.so文件。
 cp /opt/openssl/lib/pkgconfig/* /usr/lib64/pkgconfig
 在重新执行./configure
PHP扩展库 event.so
  • 在PHP源码包内找到event扩展,生成配置文件
    cd php-x.x.x/ext/event
    /opt/php/bin/phpize
  • 执行配置,生成Makefile
    ./configure --with-php-config=/opt/php/bin/php-config --with-openssl-dir=/opt/openssl --with-event-libevent-dir=/opt/libevent
  • 编译&安装
    make
    make install
  • ./configure出现的错误及解决方法
    1、configure: error: Cannot find OpenSSL’s libraries
    解决方法:
这是因为找不到openssl的动态库,因为是安装在/opt/openssl目录下的
export LD_LIBRARY_PATH=/opt/openssl/lib:$LD_LIBRARY_PATH
或
vim /etc/ld.so.conf,添加openssl动态库的路径
ldconfig

2、configure: error: bufferevent_openssl_get_ssl not found in event_openssl lib
解决方法:

----出现这个问题时还是因为找不到动态库,找了很多资料都说编辑/etc/ld.so.conf加上/usr/lib或者/usr/lib64,又或者需要libmysqlclient.so
最直观的方法是:在php-x.x.x/ext/event目录下有config.log日志文件
cat config.log 找到错误,缺什么加什么
PHP扩展库 libevent.so
  • 在PHP源码包内找到event扩展,生成配置文件
    cd php-x.x.x/ext/libevent
    /opt/php/bin/phpize
  • 执行配置,生成Makefile
    ./configure --with-php-config=/opt/php/bin/php-config
  • 编译&安装
    make
    make install
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值