如何编译Microsoft的PHP5.6?

How to compile Microsoft's PHP5.6?

提问人:hanshenrik 提问时间:7/18/2023 更新时间:7/26/2023 访问量:37

问:

应该如何编译Microsoft的php5.6?(又名 https://github.com/microsoft/php-src/tree/PHP-5.6-security-backports ) - 当我尝试“正常方式”时,失败,我使用的脚本(自定义脚本):make

#!/bin/bash

set -e

function cmd {
    source_line="${BASH_LINENO[0]}"
    echo "$@"
    t="$(date +%s.%N)"
    eval "$@"
    ret=$?
    t="$(bc <<<"$(date +%s.%N) - $t")"
    t="$(printf "%.2f" "$t")"
    echo -e "Command from $source_line took \033[0;32m$t\033[0m seconds"
    if [ $ret -ne 0 ]; then
        errstr="Command failed with exit code $ret: $@"
        echo "$errstr"
        exit 1
    fi
}
clone_php=0
if [ ! -d "php5.6-src" ]; then
    clone_php=1
fi

if [ $clone_php -eq 1 ]; then
    echo "Cloning PHP"
    cmd "rm -rf php5.6-src"
    cmd "git clone 'https://github.com/microsoft/php-src.git' --depth 1 --branch 'PHP-5.6-security-backports' php5.6-src"
    echo "Cloning PHP done"
fi

cd "php5.6-src"

bison_bin_dir="$(pwd)/bison-2.7/build/bin"
install_bison=0
if [ ! -d "$bison_bin_dir" ]; then
    install_bison=1
fi

if [ $install_bison -eq 1 ]; then
    echo "Installing Bison 2.7"
    cmd "rm -rfv bison-2.7"
    cmd "wget 'http://ftp.gnu.org/gnu/bison/bison-2.7.tar.xz'"
    cmd "tar xfv bison-2.7.tar.xz"
    cd "bison-2.7"
    cmd "wget 'https://raw.githubusercontent.com/rdslw/openwrt/e5d47f32131849a69a9267de51a30d6be1f0d0ac/tools/bison/patches/110-glibc-change-work-around.patch' -O- | git apply -"
    cmd "mkdir -pv $(printf '%q' "$bison_bin_dir")"
    cmd "./configure --prefix=$(printf '%q' "$bison_bin_dir")"
    cmd "make -j8"
    cmd "make install"
    cd ..
    echo "Installing Bison done"
fi

export PATH="$bison_bin_dir:$PATH"

libcurl_build_dir="$(pwd)/libcurl/build"
install_libcurl=0
if [ ! -d "$libcurl_build_dir" ]; then
    install_libcurl=1
fi

if [ $install_libcurl -eq 1 ]; then
    echo "Installing libcurl"
    cmd "rm -rfv libcurl"
    cmd "git clone 'https://github.com/curl/curl.git' --depth 1 libcurl"
    cd "libcurl"
    cmd "./buildconf"
    cmd "./configure --with-openssl --disable-shared --enable-static --disable-ldap --disable-ldaps --disable-rtsp --disable-dict --disable-telnet --disable-tftp --disable-pop3 --disable-imap --disable-smb --disable-smtp --disable-gopher --disable-manual --disable-ipv6 --disable-sspi --disable-crypto-auth --disable-ntlm-wb --disable-tls-srp --without-zlib --without-libidn --without-librtmp --without-winidn --without-libssh2 --without-libpsl --without-nghttp2 --without-brotli --without-zstd --without-librtmp --without-libcurl-ldap --without-libcurl-dict --without-libcurl-telnet --without-libcurl-tftp --without-libcurl-manual --without-libcurl-imap --without-libcurl-pop3 --without-libcurl-smtp --without-libcurl-gopher --without-librtmp --without-librtmp --without-winidn --without-libssh2 --without-libidn --without-librtmp"
    cmd "make -j8"
    cmd "mkdir -pv $(printf '%q' "$libcurl_build_dir")"
    cmd "make install prefix=$(printf '%q' "$libcurl_build_dir")"
    cd ..
    echo "Installing libcurl done"
fi

cmd "aclocal"
cmd "autoconf"
cmd "./buildconf --force"
cmd "./configure CFLAGS='-s -Os -g0' --disable-all --enable-cgi --enable-cli --disable-opcache-jit --disable-opcache --without-pcre-jit --with-curl=$(printf '%q' "$libcurl_build_dir") --with-libxml --with-openssl"
cmd "make -j8"

make -j8失败,并显示

./php5.6-src/libtool: line 947: X--mode=compile: command not found
./php5.6-src/libtool: line 947: X--mode=compile: command not found
./php5.6-src/libtool: line 947: X--mode=compile: command not found
./php5.6-src/libtool: line 1114: *** Warning: inferring the mode of operation is deprecated.: command not found
./php5.6-src/libtool: line 947: X--mode=compile: command not found
./php5.6-src/libtool: line 1114: *** Warning: inferring the mode of operation is deprecated.: command not found
./php5.6-src/libtool: line 1115: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
./php5.6-src/libtool: line 1258: Xcc: command not found
./php5.6-src/libtool: line 1258: X-Iext/date/lib: No such file or directory
./php5.6-src/libtool: line 1115: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
./php5.6-src/libtool: line 1258: Xcc: command not found
./php5.6-src/libtool: line 1114: *** Warning: inferring the mode of operation is deprecated.: command not found
./php5.6-src/libtool: line 1258: X-D: command not found
./php5.6-src/libtool: line 1115: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
./php5.6-src/libtool: line 1258: Xcc: command not found
./php5.6-src/libtool: line 1258: XHAVE_TIMELIB_CONFIG_H=1: command not found
./php5.6-src/libtool: line 1258: X-Iext/date/lib: No such file or directory
./php5.6-src/libtool: line 947: X--mode=compile: command not found
./php5.6-src/libtool: line 1114: *** Warning: inferring the mode of operation is deprecated.: command not found
./php5.6-src/libtool: line 1115: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
./php5.6-src/libtool: line 947: X--mode=compile: command not found
./php5.6-src/libtool: line 1258: Xcc: command not found
./php5.6-src/libtool: line 1258: X-Iext/date/lib: No such file or directory
./php5.6-src/libtool: line 947: X--mode=compile: command not found
./php5.6-src/libtool: line 1114: *** Warning: inferring the mode of operation is deprecated.: command not found
./php5.6-src/libtool: line 1258: X-D: command not found
./php5.6-src/libtool: line 1258: X-Iext/date/: No such file or directory
./php5.6-src/libtool: line 1115: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
./php5.6-src/libtool: line 1258: XHAVE_TIMELIB_CONFIG_H=1: command not found
./php5.6-src/libtool: line 1258: X-D: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/: No such file or directory
./php5.6-src/libtool: line 1258: Xcc: command not found
./php5.6-src/libtool: line 1258: X-Iext/date/: No such file or directory
./php5.6-src/libtool: line 1114: *** Warning: inferring the mode of operation is deprecated.: command not found
./php5.6-src/libtool: line 1258: XHAVE_TIMELIB_CONFIG_H=1: command not found
./php5.6-src/libtool: line 1115: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/: No such file or directory
./php5.6-src/libtool: line 1258: X-Iext/date/lib: No such file or directory
./php5.6-src/libtool: line 1258: X-Iext/date/lib: No such file or directory
./php5.6-src/libtool: line 1258: Xcc: command not found
./php5.6-src/libtool: line 1258: X-DPHP_ATOM_INC: command not found
./php5.6-src/libtool: line 1258: X-Iext/date/: No such file or directory
./php5.6-src/libtool: line 1258: X-D: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/: No such file or directory
./php5.6-src/libtool: line 1258: XHAVE_TIMELIB_CONFIG_H=1: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/include: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/main: No such file or directory
./php5.6-src/libtool: line 1114: *** Warning: inferring the mode of operation is deprecated.: command not found
./php5.6-src/libtool: line 1258: X-Iext/date/: No such file or directory
./php5.6-src/libtool: line 1258: X-DPHP_ATOM_INC: command not found
./php5.6-src/libtool: line 1115: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src: No such file or directory
./php5.6-src/libtool: line 1258: X-DPHP_ATOM_INC: command not found
./php5.6-src/libtool: line 947: X--mode=compile: command not found
./php5.6-src/libtool: line 1258: Xcc: command not found
./php5.6-src/libtool: line 1258: X-Iext/date/lib: No such file or directory
./php5.6-src/libtool: line 1258: X-Iext/date/lib: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/include: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/lib: No such file or directory
./php5.6-src/libtool: line 1258: X-D: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/ereg/regex: No such file or directory
./php5.6-src/libtool: line 1258: XHAVE_TIMELIB_CONFIG_H=1: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/libcurl/build/include: No such file or directory
./php5.6-src/libtool: line 1258: X-Iext/date/: No such file or directory
./php5.6-src/libtool: line 1114: *** Warning: inferring the mode of operation is deprecated.: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/: No such file or directory
./php5.6-src/libtool: line 1115: *** Future versions of Libtool will require --mode=MODE be specified.: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/TSRM: No such file or directory
./php5.6-src/libtool: line 1258: Xcc: command not found
./php5.6-src/libtool: line 1258: X-DPHP_ATOM_INC: command not found
./php5.6-src/libtool: line 1258: X-D: command not found
./php5.6-src/libtool: line 1258: X-D: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/include: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/Zend: No such file or directory
./php5.6-src/libtool: line 1258: XHAVE_TIMELIB_CONFIG_H=1: command not found
./php5.6-src/libtool: line 1258: X-Iext/date/lib: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/main: No such file or directory
./php5.6-src/libtool: line 1258: X-s: command not found
./php5.6-src/libtool: line 1258: X-DPHP_ATOM_INC: command not found
./php5.6-src/libtool: line 1258: X-Iext/date/: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/include: No such file or directory
./php5.6-src/libtool: line 1258: XHAVE_TIMELIB_CONFIG_H=1: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/main: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src: No such file or directory
./php5.6-src/libtool: line 1258: X-D: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/main: No such file or directory
./php5.6-src/libtool: line 1258: X-Iext/date/: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/include: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src: No such file or directory
./php5.6-src/libtool: line 1258: XHAVE_TIMELIB_CONFIG_H=1: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/main: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/lib: No such file or directory
./php5.6-src/libtool: line 1258: X-DPHP_ATOM_INC: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/lib: No such file or directory
./php5.6-src/libtool: line 1258: X-Iext/date/: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src: No such file or directory
./php5.6-src/libtool: line 1258: X-Os: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/ereg/regex: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/include: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/ereg/regex: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src: No such file or directory
./php5.6-src/libtool: line 1258: X-g0: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/lib: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/libcurl/build/include: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/main: No such file or directory
./php5.6-src/libtool: line 1258: X-DPHP_ATOM_INC: command not found
./php5.6-src/libtool: line 1258: X-DPHP_ATOM_INC: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/libcurl/build/include: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/include: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/ereg/regex: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/TSRM: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src: No such file or directory
./php5.6-src/libtool: line 1258: X-fvisibility=hidden: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/lib: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/libcurl/build/include: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/TSRM: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/ereg/regex: No such file or directory
./php5.6-src/libtool: line 1258: X-c: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/include: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/Zend: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/lib: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/main: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/libcurl/build/include: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/Zend: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/TSRM: No such file or directory
./php5.6-src/libtool: line 1311: Xext/date/php_date.lo: No such file or directory
./php5.6-src/libtool: line 1258: X-s: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/ereg/regex: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/main: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src: No such file or directory
./php5.6-src/libtool: line 1316: libtool: compile: cannot determine name of library object from `': command not found
./php5.6-src/libtool: line 1258: X-s: command not found
make: *** [Makefile:360: ext/date/php_date.lo] Error 1
make: *** Waiting for unfinished jobs....
./php5.6-src/libtool: line 1258: X-I./php5.6-src/TSRM: No such file or directory
./php5.6-src/libtool: line 1258: X-Os: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/Zend: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/libcurl/build/include: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/lib: No such file or directory
./php5.6-src/libtool: line 1258: X-Os: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/ereg/regex: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/Zend: No such file or directory
./php5.6-src/libtool: line 1258: X-g0: command not found
./php5.6-src/libtool: line 1258: X-g0: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/TSRM: No such file or directory
./php5.6-src/libtool: line 1258: X-s: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/date/lib: No such file or directory
./php5.6-src/libtool: line 1258: X-s: command not found
./php5.6-src/libtool: line 1258: X-fvisibility=hidden: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/libcurl/build/include: No such file or directory
./php5.6-src/libtool: line 1258: X-I./php5.6-src/Zend: No such file or directory
./php5.6-src/libtool: line 1258: X-fvisibility=hidden: command not found
./php5.6-src/libtool: line 1258: X-Os: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/ext/ereg/regex: No such file or directory
./php5.6-src/libtool: line 1258: X-c: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/TSRM: No such file or directory
./php5.6-src/libtool: line 1311: Xext/date/lib/timelib.lo: No such file or directory
./php5.6-src/libtool: line 1258: X-g0: command not found
./php5.6-src/libtool: line 1258: X-c: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/Zend: No such file or directory
./php5.6-src/libtool: line 1258: X-fvisibility=hidden: command not found
./php5.6-src/libtool: line 1311: Xext/date/lib/dow.lo: No such file or directory
./php5.6-src/libtool: line 1316: libtool: compile: cannot determine name of library object from `': command not found
./php5.6-src/libtool: line 1258: X-Os: command not found
./php5.6-src/libtool: line 1258: X-s: command not found
make: *** [Makefile:370: ext/date/lib/timelib.lo] Error 1
./php5.6-src/libtool: line 1258: X-c: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/libcurl/build/include: No such file or directory
./php5.6-src/libtool: line 1316: libtool: compile: cannot determine name of library object from `': command not found
./php5.6-src/libtool: line 1258: X-s: command not found
./php5.6-src/libtool: line 1258: X-Os: command not found
make: *** [Makefile:364: ext/date/lib/dow.lo] Error 1
./php5.6-src/libtool: line 1258: X-g0: command not found
./php5.6-src/libtool: line 1258: X-I./php5.6-src/TSRM: No such file or directory
./php5.6-src/libtool: line 1311: Xext/date/lib/tm2unixtime.lo: No such file or directory
./php5.6-src/libtool: line 1258: X-g0: command not found
./php5.6-src/libtool: line 1258: X-fvisibility=hidden: command not found
./php5.6-src/libtool: line 1258: X-Os: command not found
./php5.6-src/libtool: line 1316: libtool: compile: cannot determine name of library object from `': command not found
make: *** [Makefile:372: ext/date/lib/tm2unixtime.lo] Error 1
./php5.6-src/libtool: line 1258: X-I./php5.6-src/Zend: No such file or directory
./php5.6-src/libtool: line 1258: X-g0: command not found
./php5.6-src/libtool: line 1258: X-s: command not found
./php5.6-src/libtool: line 1258: X-fvisibility=hidden: command not found
./php5.6-src/libtool: line 1258: X-c: command not found
./php5.6-src/libtool: line 1258: X-fvisibility=hidden: command not found
./php5.6-src/libtool: line 1258: X-Os: command not found
./php5.6-src/libtool: line 1258: X-c: command not found
./php5.6-src/libtool: line 1311: Xext/date/lib/parse_date.lo: No such file or directory
./php5.6-src/libtool: line 1316: libtool: compile: cannot determine name of library object from `': command not found
./php5.6-src/libtool: line 1311: Xext/date/lib/parse_tz.lo: No such file or directory
make: *** [Makefile:366: ext/date/lib/parse_date.lo] Error 1
./php5.6-src/libtool: line 1258: X-c: command not found
./php5.6-src/libtool: line 1258: X-g0: command not found
./php5.6-src/libtool: line 1316: libtool: compile: cannot determine name of library object from `': command not found
./php5.6-src/libtool: line 1311: Xext/date/lib/unixtime2tm.lo: No such file or directory
make: *** [Makefile:368: ext/date/lib/parse_tz.lo] Error 1
./php5.6-src/libtool: line 1316: libtool: compile: cannot determine name of library object from `': command not found
make: *** [Makefile:374: ext/date/lib/unixtime2tm.lo] Error 1
./php5.6-src/libtool: line 1258: X-fvisibility=hidden: command not found
./php5.6-src/libtool: line 1258: X-c: command not found
./php5.6-src/libtool: line 1311: Xext/date/lib/astro.lo: No such file or directory
./php5.6-src/libtool: line 1316: libtool: compile: cannot determine name of library object from `': command not found
make: *** [Makefile:362: ext/date/lib/astro.lo] Error 1
编译器错误 php-5.6

评论


答:

0赞 hanshenrik 7/25/2023 #1

不知道为什么我不能在 Ubuntu 22.04 上构建它,但能够通过运行 Docker 在 Ubuntu 18.04 上构建它

docker build --tag build_php56 -f build_php56.Dockerfile . --progress=plain;
docker cp $(docker create build_php56):/build/php5.6/php-src/sapi/cli/php ./php5.6;

Docker文件:

# docker build --tag build_php56 -f build_php56.Dockerfile . --progress=plain
# docker cp $(docker create build_php56):/build/php5.6/php-src/sapi/cli/php ./php5.6-cli
# docker cp $(docker create build_php56):/build/php5.6/php-src/sapi/cgi/php-cgi ./php5.6-cgi
# docker run -it --rm build_php56 /bin/bash
FROM ubuntu:18.04
# build php5.6
RUN apt-get update && apt-get install -y \
    autoconf \
    automake \
    libtool \
    make \
    gcc \
    g++ \
    build-essential \
    libxml2-dev \
    libssl-dev \
    libcurl4-openssl-dev \
    pkg-config \
    libbz2-dev \
    libpng-dev \
    libjpeg-dev \
    libfreetype6-dev \
    libmcrypt-dev \
    libreadline-dev \
    libxslt1-dev \
    libzip-dev \
    libonig-dev \
    libtidy-dev \
    libxslt-dev \
    libicu-dev \
    libmemcached-dev \
    libmagickwand-dev \
    libmagickcore-dev \
    apt-utils \
    wget \
    git \
    curl \
    re2c \
    libc-client-dev libkrb5-dev
    
#<bison>
RUN wget "http://ftp.gnu.org/gnu/bison/bison-2.7.tar.xz"
RUN tar xfv bison-2.7.tar.xz
WORKDIR /bison-2.7
RUN wget "https://raw.githubusercontent.com/rdslw/openwrt/e5d47f32131849a69a9267de51a30d6be1f0d0ac/tools/bison/patches/110-glibc-change-work-around.patch" -O- | git apply -
RUN ./configure
RUN make -j$(nproc)
RUN make install;
#</bison>
#<libcurl>
#<openssl>
WORKDIR /
RUN git clone 'https://github.com/openssl/openssl' --single-branch --depth 1 --branch 'OpenSSL_1_1_1-stable'
WORKDIR /openssl
RUN ./config no-shared
RUN make -j$(nproc)
RUN mkdir lib
RUN cp *.a lib/
#</openssl>
WORKDIR /
RUN git clone --single-branch --depth 1 https://github.com/curl/curl.git
WORKDIR /curl
RUN ./buildconf
RUN LDFLAGS="-static" ./configure --with-ssl="$(realpath ../openssl)" --disable-shared  --enable-static
RUN make -j$(nproc)
#</libcurl>
RUN mkdir -p /build/php5.6
WORKDIR /build/php5.6
#RUN git clone 'https://github.com/php/php-src' --branch 'PHP-5.6' --single-branch --depth 1
RUN git clone 'https://github.com/microsoft/php-src.git' --branch 'PHP-5.6-security-backports' --single-branch --depth 1
WORKDIR /build/php5.6/php-src
RUN ./buildconf --force
#RUN ./configure --disable-all --enable-cli --enable-static --disable-shared
RUN CFLAGS='-s -Os -g0' ./configure \
#    --prefix=/usr/local/php5.6 \
    --enable-static --disable-shared \
    --disable-fpm \
    --enable-cgi \
    --enable-cli \
    --enable-mysqlnd \
    --with-mysqli=mysqlnd \
    --with-pdo-mysql=mysqlnd \
    --with-pdo-sqlite \
    --with-sqlite \
    --with-iconv-dir \
    --with-freetype-dir=/usr/include/freetype2/freetype \
    --with-jpeg-dir \
    --with-png-dir \
    --with-zlib \
    --with-libxml-dir=/usr \
    --enable-xml \
    --disable-rpath \
    --enable-bcmath \
    --enable-shmop \
    --enable-sysvsem \
    --with-curl=/curl \
    --enable-mbregex \
    --enable-mbstring \
    --with-mcrypt \
    --with-libzip \
    --with-mhash \
    --enable-pcntl \
    --enable-sockets \
    --with-xmlrpc \
    --enable-soap \
    --with-gettext \
    --enable-opcache \
    --with-xsl \
    --enable-exif \
    --enable-calendar \
    --enable-sysvmsg \
    --enable-sysvshm \
    --enable-wddx \
    --with-gd \
    --with-jpeg-dir=/usr/lib \
    --with-png-dir=/usr/lib \
    --with-freetype-dir=/usr/lib \
    --enable-gd-native-ttf \
    --enable-ftp \
    --with-kerberos \
    --with-pear \
# --enable-intl causes >./php5.6: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory \
# --with-openssl=/openssl causes: some unrecorded error \
# --enable-zip causes >./php5.6: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory \
#    --with-tidy causes ./php5.6: error while loading shared libraries: libtidy.so.5: cannot open shared object file: No such file or directory \
# --with-imap causes: some unrecorded error \
    --with-imap-ssl
RUN make -j$(nproc)
RUN ./sapi/cli/php -v