From e36da1f5a852edc4aae76db94ecfed4a38c45c1c Mon Sep 17 00:00:00 2001 From: Joe Cai Date: Wed, 22 Jun 2022 17:37:36 +1000 Subject: [PATCH] Enable opcache for php 5.5.0+ --- bin/install | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/install b/bin/install index a4b60c8..9456215 100755 --- a/bin/install +++ b/bin/install @@ -15,7 +15,7 @@ install_php() { echo "Determining configuration options..." local source_path=$(get_download_file_path $install_type $version $tmp_download_dir) - local configure_options="$(construct_configure_options $install_path)" + local configure_options="$(construct_configure_options $install_path $version)" local make_flags="-j$ASDF_CONCURRENCY" local operating_system=$(uname -a) @@ -109,8 +109,13 @@ install_composer() { $bin_path/php -r "unlink('composer-setup.php');" } +version_greater_equal() { + printf '%s\n%s\n' "$2" "$1" | sort --check=quiet --version-sort +} + construct_configure_options() { local install_path=$1 + local version=$2 # many options included below are not applicable to newer PHP versions # including these will trigger a build warning, but will not b @@ -153,6 +158,9 @@ construct_configure_options() { --with-zlib \ --without-snmp" + # opcache is bundled with php 5.5.0 and later + version_greater_equal $version "5.5.0" && global_config="$global_config --enable-opcache" + if [ "$PHP_CONFIGURE_OPTIONS" = "" ]; then local configure_options="$(os_based_configure_options) $global_config" else