- changed status to on hold
PHP 8 compatibility
Try to insatll in Docker:
FROM php:8.0.6-cli
RUN apt-get update && apt-get install -y \
libevent-dev
RUN pecl install event && docker-php-ext-enable event
In sesult have error:
Warning: PHP Startup: Unable to load dynamic library 'event' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20200930/event (/usr/local/lib/php/extensions/no-debug-non-zts-20200930/event: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20200930/event.so (/usr/local/lib/php/extensions/no-debug-non-zts-20200930/event.so: undefined symbol: socket_ce)) in Unknown on line 0
Comments (5)
-
repo owner -
reporter I’m create clean repo for demonstrate problem
https://bitbucket.org/artsf/php8_docker_ext-event/
When run `docker-compose up` take result:
\$ docker-compose up
Building php-cli
Step 1/4 : FROM php:8.0.6-cli
---> 8e9df47062cd
Step 2/4 : RUN apt-get update && apt-get install -y build-essential libevent-dev libssl-dev
---> Using cache
---> 8be27fc5be92
Step 3/4 : RUN docker-php-ext-install -j$(nproc) sockets
---> Using cache
---> d1a9130c3671
Step 4/4 : RUN docker-php-source extract && phpize && ./configure --with-event-core --with-event-extra --with-event-openssl && make install && echo 'extension=event.so' > /usr/local/etc/php/conf.d/z-event.ini && docker-php-source delete
---> Running in 85a486d5c3d7
Cannot find config.m4.
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
ERROR: Service 'php-cli' failed to build : The command '/bin/sh -c docker-php-source extract && phpize && ./configure --with-event-core --with-event-extra --with-event-openssl && make install && echo 'extension=event.so' > /usr/local/etc/php/conf.d/z-event.ini && docker-php-source delete' returned a non-zero code: 1
-
reporter Also try do this Dockerfile
FROM php:8.0.6-cli RUN apt-get update && apt-get install -y \ libevent-dev \ libssl-dev RUN docker-php-ext-install -j$(nproc) event
And have this output:
\$ docker-compose up
Building php-cli
Step 1/3 : FROM php:8.0.6-cli
---> 8e9df47062cd
Step 2/3 : RUN apt-get update && apt-get install -y libevent-dev libssl-dev
---> Using cache
---> 196bcb3b70e6
Step 3/3 : RUN docker-php-ext-install -j$(nproc) event
---> Running in c77c6be86bbd
error: /usr/src/php/ext/event does not exist
usage: /usr/local/bin/docker-php-ext-install [-jN] [--ini-name file.ini] ext-name [ext-name ...]
ie: /usr/local/bin/docker-php-ext-install gd mysqli
/usr/local/bin/docker-php-ext-install pdo pdo_mysql
/usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop
if custom ./configure arguments are necessary, see docker-php-ext-configure
Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dom enchant exif ffi fileinfo filter ftp gd gettext gmp hash iconv imap intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer xml xmlreader xmlwriter xsl zend_test zip
Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.
ERROR: Service 'php-cli' failed to build : The command '/bin/sh -c docker-php-ext-install -j$(nproc) event' returned a non-zero code: 1
-
repo owner - changed status to resolved
Okay, here is what you need:
FROM php:8.0.6-cli RUN apt-get update && apt-get install -y build-essential libevent-dev libssl-dev RUN docker-php-ext-install sockets \ && docker-php-ext-enable --ini-name 0-sockets.ini sockets RUN pecl install event \ && docker-php-ext-enable --ini-name z-event.ini event
-
reporter This works! Thanks!
FROM php:8.0.6-cli RUN apt-get update && apt-get install -y \ libevent-dev \ libssl-dev RUN docker-php-ext-install -j$(nproc) --ini-name 0-sockets.ini sockets RUN pecl install event \ && docker-php-ext-enable --ini-name z-event.ini event
- Log in to comment
Please check out my Bitbucket configuration over here https://bitbucket.org/osmanov/pecl-event/src/a210a5443bbc5f79f099a4f8a402f47a7c31b127/bitbucket-pipelines.yml
There should be little difference with the Dockerfile.
At first glance, however, it seems that you should use either
pecl
or the built-in docker functions, but not a mix of them. For example, try to usedocker-php-ext-install event
instead ofpecl install event
.