Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save saedyousef/0a1dd432133d541e9c9e2917fb547a6f to your computer and use it in GitHub Desktop.
Save saedyousef/0a1dd432133d541e9c9e2917fb547a6f to your computer and use it in GitHub Desktop.
Configure PHP7.4 with Oracle oci (Oracle Client Interface)
FROM php:7.4.3-apache
RUN apt-get update && apt-get install -y
RUN apt-get install -y wget unzip zip nano libaio-dev git
# Download Oracle SDK files
ADD https://download.oracle.com/otn_software/linux/instantclient/215000/instantclient-basic-linux.x64-21.5.0.0.0dbru.zip /opt/oracle/
ADD https://download.oracle.com/otn_software/linux/instantclient/215000/instantclient-sdk-linux.x64-21.5.0.0.0dbru.zip /opt/oracle/
ADD https://download.oracle.com/otn_software/linux/instantclient/215000/instantclient-sqlplus-linux.x64-21.5.0.0.0dbru.zip /opt/oracle/
# Extract the SDK files
RUN unzip /opt/oracle/instantclient-basic-linux.x64-*.zip -d /usr/local/ \
&& unzip /opt/oracle/instantclient-sdk-linux.x64-*.zip -d /usr/local/ \
&& unzip /opt/oracle/instantclient-sqlplus-linux.x64-*.zip -d /usr/local/
# Symlink the instantclient and the SqlPlus
RUN ln -s /usr/local/instantclient_* /usr/local/instantclient \
&& ln -s /usr/local/instantclient/sqlplus /usr/bin/sqlplus \
&& echo 'instantclient,/usr/local/instantclient' | pecl install oci8-2.2.0
# Set configurations and install
RUN docker-php-ext-configure oci8 --with-oci8=shared,instantclient,/usr/local/instantclient \
&& docker-php-ext-configure pdo_oci --with-pdo-oci=instantclient,/usr/local/instantclient \
&& docker-php-ext-install oci8 pdo_oci \
&& echo /usr/local/instantclient > /etc/ld.so.conf.d/oracle-instantclient.conf \
&& ldconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment