I’m experimenting with Ratchet, a websocket server written in PHP. I wanted to install lib-event for PHP because according to this thread it works better than PHP’s choose_stream function. It ended up being a pain:
port install libevent worked but when I ran
pecl install channel://pecl.php.net/libevent-0.0.5 it could not find the libevent headers even when I pointed it to /opt/local/lib/, which is where
port contents libevent said it was installed.
I ended up following this tutorial on compiling it from source and then pointing the pecl installer to that library and it worked. Mostly. Compiling it from source put it in /usr/local/lib, which the pecl installer liked better. Then it was a question of enabling it in PHP.
OS X’s php.ini installed here:
MacPort’s PHP is installed here:
Unless you change your default setup, apache will serve pages with OS X’s PHP, while the command line will serve pages with MacPort’s PHP.
Most of my OS X PHP extensions are installed here:
Most of my Mac Port PHP extensions are installed here:
I had to copy libevent.so from my mac’s extension directory to the macports extension directory, and add extension=libevent.so to both php.ini files.
One Response to “Install php-libevent on OS X [solved]”
Leave a Reply
You must be logged in to post a comment.