-
Notifications
You must be signed in to change notification settings - Fork 178
Document how to build static SAPI binaries? #52
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
Comments
Isn't everything (apart from always shared extensions like opcache) built statically by default? |
Most extensions can be built statically (their code is embedded in the binary, as opposed to an A concrete example, this Dockerfile builds PHP 7.2.8 with just the OpenSSL extension: FROM alpine:3.8
RUN apk add --no-cache \
alpine-sdk \
autoconf \
automake \
file \
flex \
libressl-dev \
libtool \
re2c
ENV PHP_VERSION=7.2.8
RUN cd /tmp \
&& curl -OsS http://php.net/distributions/php-${PHP_VERSION}.tar.gz \
&& tar zxof php-${PHP_VERSION}.tar.gz
ENV CFLAGS="-O3 -march=x86-64"
ENV LDFLAGS="-s -static"
RUN cd /tmp/php-${PHP_VERSION} \
&& ./configure \
EXTENSION_DIR="/usr/lib/php" \
--prefix=/usr \
--sysconfdir=/etc/php/cli \
--with-config-file-path=/etc/php/cli \
--with-config-file-scan-dir=/etc/php/cli/conf.d \
--enable-static=yes \
--enable-shared=no \
--disable-all \
--with-openssl \
--enable-cli \
--disable-fpm \
--disable-cgi \
--disable-phpdbg \
&& make -j$(grep "cpu cores" /proc/cpuinfo | wc -l) \
&& make install
but the desired outcome would be:
|
Ah okay, I see what you mean now. Unfortunately I have no idea idea how this can be achieved. |
This cant be done using our build stack. PHP has a lot of dependencies over the system, through its extensions and core. It is usually better for memory footprint and security, to build things dynamically however. |
Apparently it is not as easy as adding the
-static
flag to theLDFLAGS
environment variable before building, even though libtool sees and uses it.The text was updated successfully, but these errors were encountered: