I am trying to install OCI8 extension on my Alpine Linux Docker environment. Although there are several places saying it won't work, there are some which say it actually does. I have a 3.4
version and for corporate reasons it is staying like that for now.
I have done this within my Docker conf:
# Install Oracle Client and build OCI8 (Oracel Command Interface 8 - PHP extension)
USER root
ENV LD_LIBRARY_PATH=/usr/local/instantclient
ENV ORACLE_HOME=/usr/local/instantclient
RUN apk update && apk upgrade
RUN apk add musl-dev libaio autoconf && apk add --update make
## Unzip Instant Client v12
RUN pecl channel-update pecl.php.net
COPY instantclient_12_2.zip /var/www/html/instantclient_12_2.zip
RUN unzip -d /usr/local/ /var/www/html/instantclient_12_2.zip
RUN ln -s /usr/local/instantclient_12_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
RUN apk add gcc; exit 0 # This has a history of failing sometimes
RUN echo "instantclient,/usr/local/instantclient" | pecl install oci8 &&\
echo 'extension=oci8.so' > /usr/local/etc/php/conf.d/30-oci8.ini &&\
rm -rf /tmp/*.zip /var/cache/apk/* /tmp/pear/
Now the build passes, and it looks okay, however when I do a php -v
I am getting the following:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20160303/oci8.so' - Error loading shared library libnsl.so.1: No such file or directory (needed by /usr/local/instantclient/libclntsh.so.12.1) in Unknown on line 0
PHP version is 7.1.12
.
What I've tried is doing apk add libnsl
but this returns me this error:
ERROR: unsatisfiable constraints: so:libtirpc.so.3 (missing):
So I tried also adding apk add libtirpc-dev
(the 'plain' libtirpc
isn't available for my version or something), but that changed nothing.
Any clues?