Last active
June 16, 2023 18:32
-
-
Save ferronrsmith/ae40000873e20415c1c022e21549201b to your computer and use it in GitHub Desktop.
php_install.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# PHP 5.6 and older require OpenSSL 1.0.2, which is too old for most modern | |
# operating systems. This script downloads, builds and installs OpenSSL 1.0.2 | |
# for use in PHP builds. | |
# | |
set -ex | |
BUILD_DIR=/tmp/openssl-1.1.1-build | |
TARBALL=openssl-1.1.1u.tar.gz | |
MD5SUM=72f7ba7395f0f0652783ba1089aa0dcc | |
PREFIX=/usr/local/opt/[email protected] | |
if command -v sudo ; then | |
SUDO=sudo | |
else | |
SUDO= | |
fi | |
mkdir -p "$BUILD_DIR" | |
cd "$BUILD_DIR" | |
curl -OLs https://www.openssl.org/source/$TARBALL | |
if command -v md5sum; then | |
echo "$MD5SUM $TARBALL" | md5sum -c | |
fi | |
tar xzf $TARBALL --strip-components=1 -C "$BUILD_DIR" | |
CONFIG_SCRIPT=./config | |
ARCH_ARGS="" | |
if [ "$(uname -s)" = Darwin ] && [ "$(uname -m)" = x86_64 ]; then | |
ARCH_ARGS="darwin64-x86_64-cc enable-ec_nistp_64_gcc_128" | |
CONFIG_SCRIPT=./Configure | |
fi | |
$CONFIG_SCRIPT -fPIC shared no-ssl2 no-ssl3 no-zlib $ARCH_ARGS --prefix=/usr/local/opt/[email protected] | |
make depend | |
make -j $(nproc) | |
$SUDO make install_sw | |
# if this multiarch system uses lib64, create a symlink for it | |
# this will ensure that PHP configure script will succeed with any | |
# combination of --with-openssl and --with-libdir | |
if [ -d /usr/lib64 ]; then | |
$SUDO ln -s "$PREFIX/lib" "$PREFIX/lib64" | |
fi | |
rm -rf "$BUILD_DIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment