Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.2 Support #5

Closed
Brunnn opened this issue Feb 27, 2023 · 11 comments
Closed

PHP 8.2 Support #5

Brunnn opened this issue Feb 27, 2023 · 11 comments

Comments

@Brunnn
Copy link

Brunnn commented Feb 27, 2023

Hey mike, i've been using this extension for a long time now for PHP 7 to make my Restful API handle form-data PUT and PATCH requests.
I just migrated my project to PHP 8.2 and it seems that the extension does not support PHP ^8.2
Is that right? do you plan to add support any time soon?

@m6w6
Copy link
Owner

m6w6 commented Feb 28, 2023

Thank you for your report.

Hm. No, it should support PHP-8.2 🤔 It's been tested, a month prior 8.2 release, though.

I'll have a look!

@m6w6
Copy link
Owner

m6w6 commented Feb 28, 2023

A quick make test succeeds for me.

Any hints on why it "seems [it] does not support PHP ^8.2"?

@Brunnn
Copy link
Author

Brunnn commented Mar 2, 2023

Well, apart from the PECL website not pointing out 8.2 support, see image
image
I've tried installing the 8.1 DLL (thread safe) into PHP 8.2 and it just gave a "Could not load Module php_apfd" so I downgraded to PHP 8.1, and it worked...

I will try again here, by resintalling everything and give my feedback again.

@m6w6
Copy link
Owner

m6w6 commented Mar 3, 2023

Oh, Windows!? @cmb69, @Jan-E -- hasn't there been a rebuild the world for 8.2?

@m6w6
Copy link
Owner

m6w6 commented Mar 3, 2023

@Brunnn for the future, check out the link below the available DLLs:
Screenshot 2023-03-03 at 09 23 59

@Jan-E
Copy link

Jan-E commented Mar 3, 2023

As part of my own builds it is available at https://www.apachelounge.com/viewtopic.php?t=6359 for PHP 8.2.3.
See for instance this phpinfo() dump: https://phpdev.toolsforresearch.com/php-8.2.3-nts-Win32-vs16-x64.htm

The Windows machine for building extensions is still down AFAIK.But @cmb69 knows the details.

@Jan-E
Copy link

Jan-E commented Mar 3, 2023

You can check directly if the PHP 8.2 versions really have not been built at https://windows.php.net/downloads/pecl/releases/apfd/1.0.3/

Browse around for other versions and other extensions.

@Sallaxer
Copy link

Sallaxer commented May 29, 2023

@m6w6, I added apfd in alpine docker image(php:8.2.6-zts-alpine3.18), but it didnt work

# php -v
PHP Warning:  PHP Startup: Unable to load dynamic library 'apfd.so' (tried: /usr/lib/php82/modules/apfd.so (Error relocating /usr/lib/php82/modules/apfd.so: tsrm_get_ls_cache: symbol not found), /usr/lib/php82/modules/apfd.so.so (Error loading shared library /usr/lib/php82/modules/apfd.so.so: No such file or directory)) in Unknown on line 0
PHP 8.2.6 (cli) (built: May 19 2023 20:49:59) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.6, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.6, Copyright (c), by Zend Technologies
/ # php -m
PHP Warning:  PHP Startup: Unable to load dynamic library 'apfd.so' (tried: /usr/lib/php82/modules/apfd.so (Error relocating /usr/lib/php82/modules/apfd.so: tsrm_get_ls_cache: symbol not found), /usr/lib/php82/modules/apfd.so.so (Error loading shared library /usr/lib/php82/modules/apfd.so.so: No such file or directory)) in Unknown on line 0
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
fileinfo
filter
gd
grpc
hash
iconv
igbinary
intl
json
libxml
mbstring
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_pgsql
Phar
posix
protobuf
random
readline
redis
Reflection
session
SimpleXML
sockets
sodium
SPL
standard
tokenizer
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

My dockerfile

FROM php:8.2.6-zts-alpine3.18 as BUILDER
RUN echo $HTTP_PROXY && echo $http_proxy && unset HTTP_PROXY && unset http_proxy \
    && echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
    && echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
    && echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories \
    && apk update && apk add automake autoconf mercurial libtool linux-headers make cmake gcc musl-dev g++ openssl-dev pcre2-dev php82-dev php82-embed php82-pear ca-certificates \
    && mkdir -p /usr/lib/unit/modules \
    && hg clone https://hg.nginx.org/unit \
    && cd unit \
    && hg up 1.30.0-1  \
    && NCPU="$(getconf _NPROCESSORS_ONLN)" \
    && CONFIGURE_ARGS="--prefix=/usr --statedir=/var/lib/unit --control=unix:/var/run/control.unit.sock --pid=/var/run/unit.pid --log=/var/log/unit.log --tmpdir=/var/tmp --user=unit --group=unit --openssl" \
    && ./configure $CONFIGURE_ARGS --modulesdir=/usr/lib/unit/modules \
    && ./configure php --module=php --config=/usr/bin/php-config82 --lib-path=/usr/lib/php82 \
    && make -j $NCPU unitd \
    && make -j $NCPU php-install \
    && install -pm755 build/sbin/unitd /usr/sbin/unitd \
    && pecl install apfd \
    && docker-php-ext-enable apfd \
    && mkdir /usr/so/ \
    && cp $(php-config --extension-dir)/apfd.so /usr/so/ \
    && chmod 755 /usr/so/*.so \
    && mkdir /usr/ini/ \
    && echo "extension=apfd.so" > /usr/ini/apfd.ini

FROM alpine:3.18
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories &&\
    echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories &&\
    echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories &&\
    apk update && apk add --upgrade openssl \
      ca-certificates \
      mpdecimal \
      protobuf-dev \
      libprotobuf \
      libprotoc \
      grpc \
      grpc-plugins \
      icu-libs \
      pcre2 \
      php82 \
      php82-bcmath \
      php82-cli \
      php82-ctype \
      php82-curl \
      php82-dom \
      php82-embed \
      php82-fileinfo \
      php82-gd \
      php82-iconv \
      php82-intl \
      php82-mbstring \
      php82-mysqli \
      php82-opcache \
      php82-pcntl \
      php82-pdo_pgsql \
      php82-pdo_mysql \
      #php82-pecl-decimal \
      php82-pecl-grpc \ 
      php82-pecl-protobuf \
      php82-pecl-redis \
      #php82-pecl-rdkafka \
      php82-phar \
      php82-posix \
      php82-simplexml \
      php82-sockets \
      php82-sodium \
      php82-tokenizer \
      php82-xml \
      php82-xmlreader \
      php82-xmlwriter \
      php82-zip
COPY --from=BUILDER /usr/sbin/unitd /usr/sbin/unitd
COPY --from=BUILDER /usr/lib/unit/ /usr/lib/unit/
COPY --from=BUILDER /usr/so/ /usr/lib/php82/modules/
COPY --from=BUILDER /usr/ini/ /etc/php82/conf.d/
RUN echo "hosts: files dns" >> /etc/nsswitch.conf
RUN ln -sf /dev/stdout /var/log/unit.log
RUN ln -sf /usr/bin/php82 /usr/bin/php

CMD ["unitd", "--no-daemon", "--user", "root", "--group", "root", "--control", "unix:/var/run/control.unit.sock"]

@m6w6
Copy link
Owner

m6w6 commented May 30, 2023

You installed on ZTS and switched afterwards to NTS.

@Sallaxer
Copy link

Sallaxer commented May 30, 2023

You installed on ZTS and switched afterwards to NTS.

Thanks a lot. I use zts because they disable sapi for cli in alpine images (docker-library/php#1355 (comment)) ((
Now it works

FROM alpine:3.18 as UNITD_BUILDER
RUN echo $HTTP_PROXY && echo $http_proxy && unset HTTP_PROXY && unset http_proxy \
    && echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
    && echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
    && echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories \
    && apk update && apk add automake autoconf mercurial libtool linux-headers make cmake gcc musl-dev g++ openssl-dev pcre2-dev file re2c zlib-dev git perl perl-dev python3-dev python3 ruby ruby-dev curl libxml2-dev sqlite-dev ca-certificates \
    && curl -LO https://www.php.net/distributions/php-8.2.6.tar.gz \
    && tar -xf php-8.2.6.tar.gz \
    && rm php-8.2.6.tar.gz \
    && cd php-8.2.6 \
    && ./configure --enable-embed && make && make install \
    && cd / \
    && mkdir -p /usr/lib/unit/modules \
    && hg clone https://hg.nginx.org/unit \
    && cd unit \
    && hg up 1.30.0-1  \
    && NCPU="$(getconf _NPROCESSORS_ONLN)" \
    && CONFIGURE_ARGS="--prefix=/usr --statedir=/var/lib/unit --control=unix:/var/run/control.unit.sock --pid=/var/run/unit.pid --log=/var/log/unit.log --tmpdir=/var/tmp --user=unit --group=unit --openssl" \
    && ./configure $CONFIGURE_ARGS --modulesdir=/usr/lib/unit/modules \
    && ./configure php --module=php --config=/usr/local/bin/php-config --lib-path=/usr/local/lib/php \
    && make -j $NCPU unitd \
    && make -j $NCPU php-install \
    && install -pm755 build/sbin/unitd /usr/sbin/unitd 

FROM php:8.2.6-cli-alpine3.18 as PECL_BUILDER
RUN echo $HTTP_PROXY && echo $http_proxy && unset HTTP_PROXY && unset http_proxy \
    && echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
    && echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
    && echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories \
    && apk update && apk add gcc \
    musl-dev \
    make \
    autoconf \
    php82-pear \
    php82-dev \
    && pecl install apfd \
    && docker-php-ext-enable apfd \
    && mkdir /usr/so/ \
    && cp $(php-config --extension-dir)/apfd.so /usr/so/ \
    && chmod 755 /usr/so/*.so \
    && mkdir /usr/ini/ \
    && echo "extension=apfd.so" > /usr/ini/apfd.ini

FROM alpine:3.18
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories &&\
    echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories &&\
    echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories &&\
    apk update && apk add --upgrade openssl \
      ca-certificates \
      mpdecimal \
      protobuf-dev \
      libprotobuf \
      libprotoc \
      grpc \
      grpc-plugins \
      icu-libs \
      pcre2 \
      php82 \
      php82-bcmath \
      php82-cli \
      php82-ctype \
      php82-curl \
      php82-dom \
      php82-embed \
      php82-fileinfo \
      php82-gd \
      php82-iconv \
      php82-intl \
      php82-mbstring \
      php82-mysqli \
      php82-opcache \
      php82-pcntl \
      php82-pdo_pgsql \
      php82-pdo_mysql \
      php82-pecl-decimal \
      php82-pecl-grpc \ 
      php82-pecl-protobuf \
      php82-pecl-redis \
      php82-pecl-rdkafka \
      php82-phar \
      php82-posix \
      php82-simplexml \
      php82-sockets \
      php82-sodium \
      php82-tokenizer \
      php82-xml \
      php82-xmlreader \
      php82-xmlwriter \
      php82-zip
COPY --from=UNITD_BUILDER /usr/sbin/unitd /usr/sbin/unitd
COPY --from=UNITD_BUILDER /usr/lib/unit/ /usr/lib/unit/
COPY --from=UNITD_BUILDER /usr/local/lib/libphp.so /usr/lib/libphp.so
COPY --from=UNITD_BUILDER /usr/lib/libsqlite3.so.0 /usr/lib/libsqlite3.so.0
COPY --from=PECL_BUILDER /usr/so/ /usr/lib/php82/modules/
COPY --from=PECL_BUILDER /usr/ini/ /etc/php82/conf.d/
RUN echo "hosts: files dns" >> /etc/nsswitch.conf
RUN ln -sf /dev/stdout /var/log/unit.log
RUN ln -sf /usr/bin/php82 /usr/bin/php

CMD ["unitd", "--no-daemon", "--user", "root", "--group", "root", "--control", "unix:/var/run/control.unit.sock"]

@m6w6 m6w6 closed this as completed May 30, 2023
@andypost
Copy link

Packaged to Alpinelinux, FYI both 8.2 and 8.3 version works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants