0

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.

Lafdoma
  • 41
  • 8

1 Answers1

1

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.

  • I installed event library with PECL. But the event_base_new() function is a libevent function not a event function : http://php.net/manual/en/function.event-base-new.php. It is in the libevent section. Now, the event function works, but not the libevent ones. Also, the PECL from event and libevent have conflict : Failed to download pecl/libevent, version "0.0.1", latest release is version 0.1.0, stability "beta", use "channel://pecl.php.net/libevent-0.1.0" to install – Lafdoma May 14 '18 at 18:36
  • Then you want the `libevent` extension, not `event`. –  May 14 '18 at 18:37
  • So, finally, the libevent one is outdated. I tried to installed it alone, and it requires an old version of PHP (<6). Thank for the help. – Lafdoma May 14 '18 at 18:44