Search code examples
phpapachemodulelibeventapache-modules

How install libevent extension in Apache2


I try to install libevent in the php of my Apache2.4 in Ubuntu 16.04 but I can't do it.

I have this snippet of code for know if the library is detected in a test page on my apache server :

$test = event_base_new();

It says to me

Call to undefined function event_base_new()

I miss some informations like I don't know if a library is considered a mod (I think no) but i found no documentation about libraries in the Apache2 doc.

I compiled the source libevent-2.1.8-stable from the official website and add the line in my php.ini (php/apache2) :

extension=/usr/local/libevent.so 

I restarted my Apache2 but that doesn't work.


Solution

  • The libevent extension is not distributed with PHP. It is separate from the event extension, also separate from (but related to) the libevent C library, and it is entirely unrelated to the Apache event MPM.

    If you want to install the PHP libevent extension, you will need to install it from PECL. However, that extension isn't compatible with PHP 7, and hasn't been updated since 2013, so you probably don't want it.