From 0792766d4131912b6c5e3f8f52d6004308eee333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Zonta?= Date: Thu, 28 May 2020 13:37:01 -0300 Subject: [PATCH] =?UTF-8?q?Added=20support=20for=20OCI8=20extension=20in?= =?UTF-8?q?=20php-worker,=20Sugest=C3=A3o=20do=20amigo=20@bestlong=20in=20?= =?UTF-8?q?#2276?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 1 + env-example | 2 ++ php-worker/Dockerfile | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index d4775db4..f8877c5b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -277,6 +277,7 @@ services: - INSTALL_GMP=${PHP_WORKER_INSTALL_GMP} - INSTALL_PGSQL=${PHP_WORKER_INSTALL_PGSQL} - INSTALL_BCMATH=${PHP_WORKER_INSTALL_BCMATH} + - INSTALL_OCI8=${PHP_WORKER_INSTALL_OCI8} - INSTALL_PHALCON=${PHP_WORKER_INSTALL_PHALCON} - INSTALL_SOAP=${PHP_WORKER_INSTALL_SOAP} - INSTALL_ZIP_ARCHIVE=${PHP_WORKER_INSTALL_ZIP_ARCHIVE} diff --git a/env-example b/env-example index 278192f8..d6029de4 100644 --- a/env-example +++ b/env-example @@ -243,6 +243,8 @@ PHP_WORKER_INSTALL_GD=false PHP_WORKER_INSTALL_GMP=false PHP_WORKER_INSTALL_PGSQL=false PHP_WORKER_INSTALL_BCMATH=false +# PHP_WORKER_INSTALL_OCI8 Does not work in php5.6 version +PHP_WORKER_INSTALL_OCI8=false PHP_WORKER_INSTALL_PHALCON=false PHP_WORKER_INSTALL_SOAP=false PHP_WORKER_INSTALL_ZIP_ARCHIVE=false diff --git a/php-worker/Dockerfile b/php-worker/Dockerfile index 9568177c..9cefe540 100644 --- a/php-worker/Dockerfile +++ b/php-worker/Dockerfile @@ -81,6 +81,47 @@ RUN if [ ${INSTALL_BCMATH} = true ]; then \ docker-php-ext-install bcmath \ ;fi +########################################################################### +# PHP OCI8: +########################################################################### + +ARG INSTALL_OCI8=false + +ENV LD_LIBRARY_PATH="/usr/local/instantclient" +ENV ORACLE_HOME="/usr/local/instantclient" + +RUN if [ ${INSTALL_OCI8} = true ] && [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ]; then \ + apk add make php7-pear php7-dev gcc musl-dev libnsl libaio poppler-utils libzip-dev zip unzip libaio-dev freetds-dev && \ + ## Download and unarchive Instant Client v11 + curl -o /tmp/basic.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-basic-linux.x64-11.2.0.4.0.zip && \ + curl -o /tmp/sdk.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sdk-linux.x64-11.2.0.4.0.zip && \ + curl -o /tmp/sqlplus.zip https://raw.githubusercontent.com/bumpx/oracle-instantclient/master/instantclient-sqlplus-linux.x64-11.2.0.4.0.zip && \ + unzip -d /usr/local/ /tmp/basic.zip && \ + unzip -d /usr/local/ /tmp/sdk.zip && \ + unzip -d /usr/local/ /tmp/sqlplus.zip \ + ## Links are required for older SDKs + && ln -s /usr/local/instantclient_11_2 ${ORACLE_HOME} && \ + ln -s ${ORACLE_HOME}/libclntsh.so.* ${ORACLE_HOME}/libclntsh.so && \ + ln -s ${ORACLE_HOME}/libocci.so.* ${ORACLE_HOME}/libocci.so && \ + ln -s ${ORACLE_HOME}/lib* /usr/lib && \ + ln -s ${ORACLE_HOME}/sqlplus /usr/bin/sqlplus &&\ + ln -s /usr/lib/libnsl.so.2.0.0 /usr/lib/libnsl.so.1 && \ + ## Build OCI8 with PECL + echo "instantclient,${ORACLE_HOME}" | pecl install oci8 && \ + echo 'extension=oci8.so' > /etc/php7/conf.d/30-oci8.ini \ + # Clean up + apk del php7-pear php7-dev gcc musl-dev && \ + rm -rf /tmp/*.zip /tmp/pear/ && \ + docker-php-ext-configure pdo_oci --with-pdo-oci=instantclient,/usr/local/instantclient \ + && docker-php-ext-configure pdo_dblib --with-libdir=/lib \ + && docker-php-ext-install pdo_oci \ + && docker-php-ext-enable oci8 \ + && docker-php-ext-install zip && \ + # Install the zip extension + docker-php-ext-configure zip && \ + php -m | grep -q 'zip' \ +;fi + # Install PostgreSQL drivers: ARG INSTALL_PGSQL=false RUN if [ ${INSTALL_PGSQL} = true ]; then \