php-ds / ext-ds

An extension providing efficient data structures for PHP 7
https://medium.com/p/9dda7af674cd
MIT License
2.11k stars 95 forks source link

How to install in PHP8 Docker alpine:version image? #177

Open jonatansantana opened 3 years ago

jonatansantana commented 3 years ago

I tried to install using pecl, curl, pickle and some other suggested ways I found on the internet, but with no success. Is this extension really available for php8?

This work:

 RUN apk --no-cache add \
  php8 \
  php8-curl 

But...

 RUN apk --no-cache add \
  php8 \
  php8-ds  #or php8-pecl-ds

Not work.

I tried using this another way. No error occurs, I assume I have it installed, but I can't use the extension. I don't know if I need to do anything else. I would like some help with that.

&& mkdir -p /usr/bin/php/ext/ds && curl -fsSL https://pecl.php.net/get/ds | tar xvz -C "/usr/bin/php/ext/ds" --strip 1

enumag commented 3 years ago

It works just fine using pecl.

FROM php:8.0-alpine

RUN apk add --no-cache ${PHPIZE_DEPS} && \
    pecl install ds && \
    docker-php-ext-enable ds
jonatansantana commented 3 years ago

Not work for FROM alpine:3.14. do you know how i can install using this image?

enumag commented 3 years ago

Well you need to use base PHP image obviously. If you want Alpine 3.14 then it's FROM php:8.0-fpm-alpine3.14

jonatansantana commented 3 years ago

A feather. I would like to continue using the linux alpine image and install the necessary extensions for me. :/

enumag commented 3 years ago

Well you still need to install manually from pecl because no official package exists for this extension... So pecl install ds and then add it to php.ini... You will likely need to apk install php8-dev first to use pecl this way.

rtheunissen commented 2 years ago

@jonatansantana did you get this working? Are you still trying to otherwise?

dilawar commented 1 year ago

I get the following output when I do pecl install ds in an alpine image.

Build process completed successfully

**Installing '/usr/local/lib/php/extensions/no-debug-non-zts-20220829/ds.so'**
install ok: channel://pecl.php.net/ds-1.4.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=ds.so" to php.ini
...

I don't think ds.so is installed in correct place?!

rtheunissen commented 1 year ago

I think you'd still need to enable the extension, I'm not sure that pecl does that for you. This is otherwise a pecl issue and not a fault of this project, right?