diff --git a/docker-compose.yml b/docker-compose.yml index d4775db..f8877c5 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 278192f..d6029de 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 9568177..9cefe54 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 \