Skip to content

Instantly share code, notes, and snippets.

@thirdwheel
Last active October 24, 2022 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thirdwheel/057af38cf8384dd3184cea8a28a9dd8a to your computer and use it in GitHub Desktop.
Save thirdwheel/057af38cf8384dd3184cea8a28a9dd8a to your computer and use it in GitHub Desktop.
PHP build environment
#!/bin/sh
[ $1 ] || exit
wget https://www.php.net/distributions/php-$1.tar.gz
tar -xf php-$1.tar.gz
cd php-$1
mkdir _build
cd _build
../configure --prefix=/opt/php/$1/ --includedir=/opt/php/$1/include --mandir=/opt/php/$1/share/man \
--infodir=/opt/php/$1/share/info --sysconfdir=/opt/php/$1/etc --localstatedir=/opt/php/$1/var \
--libdir=/opt/php/$1/lib/x86_64-linux-gnu --libexecdir=/opt/php/$1/lib/x86_64-linux-gnu --enable-cli \
--enable-cgi --disable-phpdbg --disable-all --disable-debug --disable-rpath --disable-static --with-pic \
--with-layout=GNU --without-pear --enable-filter --with-openssl=yes --with-password-argon2=/usr --with-mhash=/usr \
--with-libxml --enable-session --with-sodium --with-zlib=/usr --with-zlib-dir=/usr --with-unixODBC=shared,/usr \
--with-pdo-odbc=shared,unixODBC,/usr --with-readline=shared,/usr --with-sqlite3=shared,/usr --with-pdo-sqlite=shared,/usr \
--enable-dom=shared --enable-simplexml=shared --enable-xml=shared --enable-xmlreader=shared --enable-xmlwriter=shared \
--with-xsl=shared,/usr --with-pdo-dblib=shared,/usr --with-gmp=shared,/usr --with-ldap=shared,/usr --with-ldap-sasl=/usr \
--enable-calendar=shared --enable-ctype=shared --enable-exif=shared --enable-fileinfo=shared --enable-ftp=shared \
--with-openssl-dir=/usr --with-gettext=shared,/usr --with-iconv=shared --enable-pdo=shared --enable-phar=shared \
--enable-posix=shared --enable-shmop=shared --enable-sockets=shared --enable-sysvmsg=shared --enable-sysvsem=shared \
--enable-sysvshm=shared --enable-tokenizer=shared --enable-intl=shared --with-snmp=shared,/usr --with-pgsql=shared,/usr \
--with-pdo-pgsql=shared,/usr --enable-mbstring=shared --enable-mbregex --enable-opcache --enable-huge-code-pages \
--with-imap=shared,/usr --with-kerberos --with-imap-ssl=yes --with-bz2=shared,/usr --enable-mysqlnd=shared \
--enable-mysqlnd-compression-support --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-tidy=shared,/usr \
--enable-soap=shared --enable-dba=shared --with-db4=/usr --with-gdbm --enable-inifile --enable-flatfile \
--without-pdo-firebird --with-pspell=shared,/usr --enable-bcmath=shared --with-curl=shared,/usr --disable-dtrace
make -j$(grep -c 'processor *' /proc/cpuinfo)
FROM alpine:3.14.2
RUN apk add --no-cache alpine-sdk xmlrpc-c-dev bzip2-dev talloc-dev sqlite-dev icu-dev jpeg-dev net-snmp-dev heimdal-dev db-dev \
cyrus-sasl-dev openldap-dev libxpm-dev tdb-dev zlib-dev tevent-dev openssl-dev libxcb-dev readline-dev \
brotli-dev recode-dev freetds-dev libedit-dev tidyhtml-dev musl-dev freetype-dev imagemagick-dev gdbm-dev \
argon2-dev aspell-dev imap-dev libjpeg-turbo-dev e2fsprogs-dev gmp-dev unixodbc-dev curl-dev libsodium-dev \
postgresql-dev libc-dev libx11-dev oniguruma-dev libwebp-dev gd-dev pcre2-dev libxml2-dev libxau-dev \
util-linux-dev libxdmcp-dev libpng-dev pcre-dev ncurses-dev libxslt-dev xz-dev libzip-dev gettext-dev ldb-dev \
nghttp2-dev openssl-dev sqlite-dev nano
RUN rm -f build.sh
RUN wget -O build.sh https://gist.github.com/thirdwheel/057af38cf8384dd3184cea8a28a9dd8a/raw/build.sh
RUN chmod 755 build.sh
CMD ["sleep", "1000d"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment