Skip to content

Commit

Permalink
Update PHP installers to support PHP configuration options on the com…
Browse files Browse the repository at this point in the history
…mand line.
  • Loading branch information
patrickcarlohickman committed Feb 2, 2024
1 parent f00f642 commit 28d6ef3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion setup/installers/install-php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ readonly PHP_VERSION="${REQUESTED_VERSION}"
readonly PHP_VERSION_COMPARE="${PHP_VERSION/snapshot/.9999}"
readonly PHPENV_ROOT="${PHPENV_ROOT:-/opt/phpenv}"

shift
readonly PHP_OPTIONS=( "$@" )

if [[ ! "${PHP_VERSION}" =~ ^[0-9]+(\.[0-9]+)*(snapshot)?$ ]]; then
log_error "Version parameter [${PHP_VERSION}] is not in the correct format."
exit 1
Expand All @@ -34,7 +37,7 @@ ensure_not_installed "phpenv_version-${PHP_VERSION_INSTALL}" "PHP version [${PHP

log_info "Checking and installing needed dependencies."

BUILD_CONFIGURE_OPTIONS=()
BUILD_CONFIGURE_OPTIONS=( "${PHP_OPTIONS[@]}" )
BUILD_PKG_CONFIG_PATH=()

# PHP < 7.1.17, 7.2.0 - 7.2.4
Expand Down
7 changes: 5 additions & 2 deletions setup/resources/php/install-php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
source "$(dirname "$(dirname "$(readlink -f "${0}")")")/init-resource.sh"

function usage {
echo "Usage: $(script_name) < php_version | latest >"
echo "Usage: $(script_name) < php_version | latest > [ php_options ]"
}

PHP_VERSION="${1}"
Expand All @@ -13,6 +13,9 @@ if [[ $# -lt 1 || "${PHP_VERSION}" = "-h" || "${PHP_VERSION}" = "--help" ]]; the
exit 1
fi

shift
readonly PHP_OPTIONS="$@"

ensure_root
ensure_installed "PHPENV" "PHPENV is required but is not found at ${PHPENV_ROOT} or is not loaded. If using sudo, make sure to use a login shell (sudo -i)."

Expand All @@ -24,6 +27,6 @@ if [[ "${PHP_VERSION}" == "latest" ]]; then
log_info "Latest PHP version resolved to ${PHP_VERSION}."
fi

run_installer "install-php.sh" "${PHP_VERSION}"
run_installer "install-php.sh" "${PHP_VERSION}" ${PHP_OPTIONS}

log_info "PHP version ${PHP_VERSION} is now available."

0 comments on commit 28d6ef3

Please sign in to comment.