Skip to content

Commit 9ecad92

Browse files
committed
compat with latest version
1 parent c3006e5 commit 9ecad92

4 files changed

Lines changed: 88 additions & 9 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RUN apt-get update && \
3232
&& \
3333
apt-get clean
3434

35-
RUN git clone --depth=1 --single-branch --branch=frankenphp-8.2 https://github.com/dunglas/php-src.git && \
35+
RUN git clone --depth=1 --single-branch --branch=frankenphp https://github.com/dunglas/php-src.git && \
3636
cd php-src && \
3737
# --enable-embed is only necessary to generate libphp.so, we don't use this SAPI directly
3838
./buildconf && \

Dockerfile.alpine

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,86 @@
1-
FROM php:8.2-zts-alpine3.17 AS builder
1+
FROM php:8.2-zts-alpine3.17 AS php-base
22

3-
COPY --from=golang:1.19-alpine3.17 /usr/local/go/bin/go /usr/local/bin/go
4-
COPY --from=golang:1.19-alpine3.17 /usr/local/go /usr/local/go
3+
# Note that this image is based on the official PHP image, once https://github.com/php/php-src/pull/10141 is merged, this stage can be removed
4+
5+
RUN rm -Rf /usr/local/include/php/ /usr/local/lib/libphp.* /usr/local/lib/php/ /usr/local/php/
6+
7+
ENV PHPIZE_DEPS \
8+
autoconf \
9+
dpkg-dev dpkg \
10+
file \
11+
g++ \
12+
gcc \
13+
libc-dev \
14+
make \
15+
pkgconf \
16+
re2c
17+
18+
RUN apk add --no-cache --virtual .build-deps \
19+
$PHPIZE_DEPS \
20+
argon2-dev \
21+
coreutils \
22+
curl-dev \
23+
readline-dev \
24+
libsodium-dev \
25+
sqlite-dev \
26+
openssl-dev \
27+
libxml2-dev \
28+
gnu-libiconv-dev \
29+
linux-headers \
30+
oniguruma-dev \
31+
bison \
32+
git
33+
34+
RUN git clone --depth=1 --single-branch --branch=frankenphp https://github.com/dunglas/php-src.git
35+
36+
WORKDIR /php-src/
37+
38+
# --enable-embed is only necessary to generate libphp.so, we don't use this SAPI directly
39+
RUN ./buildconf
40+
RUN ./configure \
41+
--enable-embed \
42+
--enable-zts \
43+
--disable-zend-signals \
44+
# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself)
45+
--enable-mysqlnd \
46+
# make sure invalid --configure-flags are fatal errors instead of just warnings
47+
--enable-option-checking=fatal \
48+
# https://github.com/docker-library/php/issues/439
49+
--with-mhash \
50+
# https://github.com/docker-library/php/issues/822
51+
--with-pic \
52+
# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236)
53+
--enable-ftp \
54+
# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195)
55+
--enable-mbstring \
56+
# https://wiki.php.net/rfc/argon2_password_hash
57+
--with-password-argon2 \
58+
# https://wiki.php.net/rfc/libsodium
59+
--with-sodium=shared \
60+
# always build against system sqlite3 (https://github.com/php/php-src/commit/6083a387a81dbbd66d6316a3a12a63f06d5f7109)
61+
--with-pdo-sqlite=/usr \
62+
--with-sqlite3=/usr \
63+
--with-curl \
64+
--with-iconv \
65+
--with-openssl \
66+
--with-readline \
67+
--with-zlib \
68+
# https://github.com/bwoebi/phpdbg-docs/issues/1#issuecomment-163872806 ("phpdbg is primarily a CLI debugger, and is not suitable for debugging an fpm stack.")
69+
--disable-phpdbg \
70+
--with-config-file-path="$PHP_INI_DIR" \
71+
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d"
72+
RUN make -j$(nproc)
73+
RUN make install
74+
RUN rm -Rf /php-src/
75+
RUN echo "Creating src archive for building extensions\n"
76+
RUN tar -c -f /usr/src/php.tar.xz -J /php-src/
77+
#RUN ldconfig
78+
RUN php --version
79+
80+
FROM php-base AS builder
81+
82+
COPY --from=golang:alpine3.16 /usr/local/go/bin/go /usr/local/bin/go
83+
COPY --from=golang:alpine3.16 /usr/local/go /usr/local/go
584

685
RUN apk add --no-cache --virtual .build-deps \
786
$PHPIZE_DEPS \
@@ -44,7 +123,7 @@ RUN cd caddy/frankenphp && \
44123

45124
ENTRYPOINT ["/bin/sh","-c"]
46125

47-
FROM php:8.2-zts-alpine3.17 AS final
126+
FROM php:8.2-zts-alpine3.16 AS final
48127

49128
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
50129

Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ RUN apt-get update && \
3737
&& \
3838
apt-get clean
3939

40-
RUN git clone --branch=frankenphp-8.2 https://github.com/dunglas/php-src.git && \
40+
RUN git clone --branch=frankenphp https://github.com/dunglas/php-src.git && \
4141
cd php-src && \
4242
# --enable-embed is only necessary to generate libphp.so, we don't use this SAPI directly
4343
./buildconf && \

frankenphp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ ZEND_TSRMLS_CACHE_DEFINE()
2525
#endif
2626

2727
/* Timeouts are currently fundamentally broken with ZTS except on Linux: https://bugs.php.net/bug.php?id=79464 */
28-
#ifndef ZEND_TIMER
28+
#ifndef ZEND_TIMERS
2929
static const char HARDCODED_INI[] =
3030
"max_execution_time=0\n"
3131
"max_input_time=-1\n\0";
@@ -61,7 +61,7 @@ frankenphp_config frankenphp_get_config() {
6161
#else
6262
false,
6363
#endif
64-
#ifdef ZEND_TIMER
64+
#ifdef ZEND_TIMERS
6565
true,
6666
#else
6767
false,
@@ -559,7 +559,7 @@ static void *manager_thread(void *arg) {
559559

560560
sapi_startup(&frankenphp_sapi_module);
561561

562-
#ifndef ZEND_TIMER
562+
#ifndef ZEND_TIMERS
563563
frankenphp_sapi_module.ini_entries = malloc(sizeof(HARDCODED_INI));
564564
memcpy(frankenphp_sapi_module.ini_entries, HARDCODED_INI, sizeof(HARDCODED_INI));
565565
#endif

0 commit comments

Comments
 (0)