ext-event doesn't work on Alpine

Issue #59 closed
Jáchym Toušek created an issue

After installing ext-event using pecl I’m getting this error:

PHP Warning:  PHP Startup: Unable to load dynamic library 'event.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20190902/event.so (Error loading shared library libevent_openssl-2.1.so.6: No such file or directory (needed by /usr/local/lib/php/extensions/no-debug-non-zts-20190902/event.so)), /usr/local/lib/php/extensions/no-debug-non-zts-20190902/event.so.so (Error loading shared library /usr/local/lib/php/extensions/no-debug-non-zts-20190902/event.so.so: No such file or directory)) in Unknown on line 0

I think the reason is that libevent_openssl-2.1.so.6 does not exist. The libevent package contains libevent_openssl-2.1.so.7 instead (see https://pkgs.alpinelinux.org/contents?branch=edge&name=libevent&arch=x86_64&repo=main).

Any idea how to fix this?

By the way any idea how to disable the openssl support when installing via pecl? I know there is a prompt for it normally but I need to do it in no-interaction mode since I install the extension in a Dockerfile.

If there is no way to do that with pecl install then how do I install this extension without pecl?

Comments (5)

  1. Ruslan Osmanov repo owner

    You might have pecl-event compiled before the new libevent_openssl version was installed. Re-building pecl-event should fix the problem, but, I guess, you tried that already.

    pecl-event can be built without SSL support as follows:

    phpize
    ./configure --with-event-core --with-event-extra --without-event-openssl --disable-event-debug
    make
    # make install
    

    If the above doesn't help, you can send me a docker file, and I'll try to find out what could go wrong

  2. Jáchym Toušek reporter

    You might have pecl-event compiled before the new libevent_openssl version was installed.

    Hmm… perhaps there is some problem with the fact that I’m using multi-stage Dockerfile to separate extensions installation from everything else (to make the final image as small as possible). I simplified my Dockerfile to this (the issue is still there):

    ARG PHP_VERSION=7.4
    
    
    FROM composer AS composer
    
    
    FROM php:${PHP_VERSION}-alpine AS extensions
    
    RUN echo "Installing build dependencies..." && \
        apk add --no-cache libevent-dev openssl-dev ${PHPIZE_DEPS} && \
        echo "Installing PHP extensions..." && \
        docker-php-ext-install sockets && \
        pecl install event && \
        docker-php-ext-enable --ini-name extensions.ini event
    
    
    FROM php:${PHP_VERSION}-fpm-alpine
    
    COPY --from=composer /usr/bin/composer /usr/bin/composer
    COPY --from=extensions /usr/local/lib/php/extensions /usr/local/lib/php/extensions
    COPY --from=extensions /usr/local/etc/php/conf.d /usr/local/etc/php/conf.d
    
    RUN apk add --no-cache libevent
    

    Reference: https://chrisguitarguy.com/2017/12/16/multi-stage-docker-php/

    I never had any issues with this approach until now.

  3. Jáchym Toušek reporter

    Ah ok, it seems some of my local images were outdated and it caused a problem with the multistage approach. docker build . --pull fixed the problem. Thanks for getting me on the right track.

  4. Log in to comment