From 377f714c9b768c0ee018e5b0c0490c0d6763aec5 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Thu, 24 Mar 2022 14:04:40 +0100 Subject: [PATCH] Make it easier to install Oracle Instant Client Basic (#535) --- .github/workflows/test-extensions.yml | 12 ++++++++++++ README.md | 1 + install-php-extensions | 16 ++++++++++++---- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-extensions.yml b/.github/workflows/test-extensions.yml index d185e0e..55f8d30 100644 --- a/.github/workflows/test-extensions.yml +++ b/.github/workflows/test-extensions.yml @@ -150,3 +150,15 @@ jobs: - name: Checkout uses: actions/checkout@v2 - run: docker run --rm --volume "$(pwd):/app" --workdir /app "php:7.4-${{ matrix.distro }}" "./scripts/ci-markused-${{ matrix.distro }}" + test_instantclient_basic: + name: Test using Oracle Instant Client Basic + needs: + - check_syntax_data + - check_syntax_shell + - check_syntax_php + runs-on: ubuntu-latest + container: php:8.1-cli-alpine + steps: + - name: Checkout + uses: actions/checkout@v3 + - run: IPE_INSTANTCLIENT_BASIC=1 ./install-php-extensions oci8 pdo_oci diff --git a/README.md b/README.md index 1e05aad..893799e 100644 --- a/README.md +++ b/README.md @@ -323,6 +323,7 @@ Here's the list of all the supported environment variables: | lzf | `IPE_LZF_BETTERCOMPRESSION=1` | By default `install-php-extensions` compiles the `lzf` extension to prefer speed over size; you can use this environment variable to compile it preferring size over speed | | event | `IPE_EVENT_NAMESPACE=`... | By default the `event` classes are defined in the root namespace. You can use this environment variable to specify a custom namespace | | gd | IPE_GD_WITHOUTAVIF=1 | Since PHP 8.1, gd supports the AVIF format. Enabling it requires compiling libaom/libdav1d/libyuv/libavif, which is time-consuming. You can disable AVIF support by setting this environment variable | +| oci8 & pdo_oci | `IPE_INSTANTCLIENT_BASIC=1` | The oci8 and pdo_oci PHP extensions require [Oracle Instant Client](https://www.oracle.com/database/technologies/instant-client.html). In order to save disk space, we install the Basic Lite version: if you want to install the Basic (non-lite) version simply set this environment variable | ## Special requirements diff --git a/install-php-extensions b/install-php-extensions index 8c8ea28..dfe0559 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1567,11 +1567,19 @@ compareVersions() { # Set: # ORACLE_INSTANTCLIENT_LIBPATH installOracleInstantClient() { + case "${IPE_INSTANTCLIENT_BASIC:-}" in + 1 | y* | Y*) + installOracleInstantClient_handle=basic + ;; + *) + installOracleInstantClient_handle=basiclite + ;; + esac case $PHP_BITS in 32) installOracleInstantClient_client=client installOracleInstantClient_version='19.9' - installOracleInstantClient_ic=https://download.oracle.com/otn_software/linux/instantclient/199000/instantclient-basiclite-linux-$installOracleInstantClient_version.0.0.0dbru.zip + installOracleInstantClient_ic=https://download.oracle.com/otn_software/linux/instantclient/199000/instantclient-$installOracleInstantClient_handle-linux-$installOracleInstantClient_version.0.0.0dbru.zip installOracleInstantClient_sdk=https://download.oracle.com/otn_software/linux/instantclient/199000/instantclient-sdk-linux-$installOracleInstantClient_version.0.0.0dbru.zip ;; *) @@ -1579,13 +1587,13 @@ installOracleInstantClient() { aarch64*) installOracleInstantClient_client=client64 installOracleInstantClient_version='19.10' - installOracleInstantClient_ic=https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-basiclite-linux.arm64-$installOracleInstantClient_version.0.0.0dbru.zip + installOracleInstantClient_ic=https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-$installOracleInstantClient_handle-linux.arm64-$installOracleInstantClient_version.0.0.0dbru.zip installOracleInstantClient_sdk=https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-sdk-linux.arm64-$installOracleInstantClient_version.0.0.0dbru.zip ;; *) installOracleInstantClient_client=client64 installOracleInstantClient_version='21.1' - installOracleInstantClient_ic=https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-basiclite-linux.x64-$installOracleInstantClient_version.0.0.0.zip + installOracleInstantClient_ic=https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-$installOracleInstantClient_handle-linux.x64-$installOracleInstantClient_version.0.0.0.zip installOracleInstantClient_sdk=https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-sdk-linux.x64-$installOracleInstantClient_version.0.0.0.zip ;; esac @@ -1593,7 +1601,7 @@ installOracleInstantClient() { esac ORACLE_INSTANTCLIENT_LIBPATH=/usr/lib/oracle/$installOracleInstantClient_version/$installOracleInstantClient_client/lib if ! test -e "$ORACLE_INSTANTCLIENT_LIBPATH"; then - printf 'Downloading Oracle Instant Client v%s... ' "$installOracleInstantClient_version" + printf 'Downloading Oracle Instant Client v%s (%s)... ' "$installOracleInstantClient_version" "$installOracleInstantClient_handle" installOracleInstantClient_src="$(getPackageSource $installOracleInstantClient_ic)" mkdir -p "/usr/lib/oracle/$installOracleInstantClient_version/$installOracleInstantClient_client" mv "$installOracleInstantClient_src" "$ORACLE_INSTANTCLIENT_LIBPATH"