@@ -44,6 +44,23 @@ RUN yum install -y autoconf bison pkgconfig \
4444# Install mariadb-devel separately (may need different repo or skip if not critical)
4545RUN yum install -y mariadb-devel || yum install -y mariadb-connector-c-devel || echo "Warning: mariadb-devel not available, continuing without it"
4646
47+ # Build and install lexbor library (STATIC - embedded into libphp.so)
48+ ENV LEXBOR_VERSION=2.4.0
49+ RUN git clone --depth 1 --branch v${LEXBOR_VERSION} https://github.com/lexbor/lexbor.git /tmp/lexbor-src && \
50+ cd /tmp/lexbor-src && \
51+ cmake -S . -B build \
52+ -DCMAKE_BUILD_TYPE=Release \
53+ -DCMAKE_INSTALL_PREFIX=/usr/local \
54+ -DLEXBOR_BUILD_SHARED=OFF \
55+ -DLEXBOR_BUILD_STATIC=ON \
56+ -DLEXBOR_INSTALL_HEADERS=ON && \
57+ cmake --build build && \
58+ cmake --install build && \
59+ echo "Lexbor STATIC library installed:" && \
60+ ls -la /usr/local/lib*/liblexbor* || true && \
61+ ls -la /usr/local/include/lexbor/ || true && \
62+ rm -rf /tmp/lexbor-src
63+
4764# Fetch and build PHP from source with ZTS
4865FROM base AS php-build
4966ARG PHP_SRC_REF
@@ -73,6 +90,16 @@ RUN mkdir -p /usr/local/etc/php/conf.d
7390
7491# Build PHP with ZTS enabled
7592RUN ./configure \
93+ COPY --from=base /usr/local/include/lexbor /usr/local/include/lexbor
94+ COPY --from=base /usr/local/lib /usr/local/lib
95+ COPY --from=base /usr/local/lib64 /usr/local/lib64
96+
97+ # Build PHP with ZTS enabled and statically link lexbor
98+ RUN export CFLAGS="-I/usr/local/include" && \
99+ export LDFLAGS="-L/usr/local/lib -L/usr/local/lib64" && \
100+ export LIBS="/usr/local/lib64/liblexbor_static.a" && \
101+ ls -lh /usr/local/lib*/liblexbor* && \
102+ ./configure \
76103 --prefix=/usr/local \
77104 --with-config-file-path=/usr/local/lib \
78105 --with-config-file-scan-dir=/usr/local/etc/php/conf.d \
@@ -82,6 +109,13 @@ RUN ./configure \
82109 --enable-mbstring \
83110 --enable-pcntl \
84111 --enable-cgi \
112+ --enable-embed \
113+ --enable-dom \
114+ --enable-xml \
115+ --enable-simplexml \
116+ --enable-xmlreader \
117+ --enable-xmlwriter \
118+ --with-xsl \
85119 --with-extra-version="" \
86120 --with-curl \
87121 --with-mysqli \
@@ -103,12 +137,14 @@ RUN cmake -S . -B build \
103137 -DBUILD_HDR=ON && \
104138 cmake --build build && \
105139 cmake --install build && \
106- ldconfig
140+ ldconfig /usr/local/lib /usr/local/lib64
107141
108142FROM base AS final
109143
110144COPY --from=php-build /usr/local /usr/local
111145
146+ RUN ldconfig /usr/local/lib /usr/local/lib64
147+
112148COPY frankenphp-binary/ /tmp/frankenphp-binary/
113149RUN if [ -f /tmp/frankenphp-binary/frankenphp ]; then \
114150 cp /tmp/frankenphp-binary/frankenphp /usr/local/bin/frankenphp && \
@@ -123,15 +159,15 @@ RUN EXTENSION_DIR=$(php -i | grep "^extension_dir" | awk '{print $3}') && \
123159 echo "Error: Could not determine extension_dir"; \
124160 exit 1; \
125161 fi && \
126- mkdir -p "$EXTENSION_DIR" \
162+ mkdir -p "$EXTENSION_DIR" && \
127163 echo "Created extension_dir: $EXTENSION_DIR"
128164
129165# Verify ZTS is enabled
130166RUN php -v | grep -q "ZTS" || (echo "ERROR: ZTS not enabled!" && exit 1) && \
131167 php -m | grep -E 'curl|mysqli' >/dev/null
132168
133169ENV PATH="/usr/local/bin:${PATH}" \
134- LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH:-}"
170+ LD_LIBRARY_PATH="/usr/local/lib:/usr/local/lib64: ${LD_LIBRARY_PATH:-}"
135171
136172RUN ln -sf /usr/local/bin/php /usr/bin/php && \
137173 ln -sf /usr/local/sbin/php-fpm /usr/sbin/php-fpm || true && \
0 commit comments