Oracle on Alpine linux












2















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?










share|improve this question



























    2















    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?










    share|improve this question

























      2












      2








      2








      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?










      share|improve this question














      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?







      php oracle docker alpine






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 12 '18 at 14:13









      NorgulNorgul

      1,57111640




      1,57111640
























          1 Answer
          1






          active

          oldest

          votes


















          1














          I'd recommend using an operating system supported by Oracle, thus avoiding the headache of hacking Alpine and the uncertainty that it won't fall over at a critical time. And thus giving you some confidence your business won't be negatively impacted. Try https://github.com/oracle/docker-images/tree/master/OracleInstantClient



          Other comments




          • Don't set ORACLE_HOME when using Instant Client. That variable is
            for full software installs.

          • Use ldconfig to set the system library path, see
            the Instant Client installation instructions e.g. here.

          • Use Instant Client 18.3, which can connect to the same DB versions that 12.2 can. (18.3 is really the renamed 12.2.0.2 in the new versioning system)

          • Using Oracle Linux Docker images has the advantage that it will download and install the 18.3 Instant Client without you having to manually do the download.


          See this blog for info about the 'slim' Oracle Linux container it uses.






          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53263972%2foracle-on-alpine-linux%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            I'd recommend using an operating system supported by Oracle, thus avoiding the headache of hacking Alpine and the uncertainty that it won't fall over at a critical time. And thus giving you some confidence your business won't be negatively impacted. Try https://github.com/oracle/docker-images/tree/master/OracleInstantClient



            Other comments




            • Don't set ORACLE_HOME when using Instant Client. That variable is
              for full software installs.

            • Use ldconfig to set the system library path, see
              the Instant Client installation instructions e.g. here.

            • Use Instant Client 18.3, which can connect to the same DB versions that 12.2 can. (18.3 is really the renamed 12.2.0.2 in the new versioning system)

            • Using Oracle Linux Docker images has the advantage that it will download and install the 18.3 Instant Client without you having to manually do the download.


            See this blog for info about the 'slim' Oracle Linux container it uses.






            share|improve this answer






























              1














              I'd recommend using an operating system supported by Oracle, thus avoiding the headache of hacking Alpine and the uncertainty that it won't fall over at a critical time. And thus giving you some confidence your business won't be negatively impacted. Try https://github.com/oracle/docker-images/tree/master/OracleInstantClient



              Other comments




              • Don't set ORACLE_HOME when using Instant Client. That variable is
                for full software installs.

              • Use ldconfig to set the system library path, see
                the Instant Client installation instructions e.g. here.

              • Use Instant Client 18.3, which can connect to the same DB versions that 12.2 can. (18.3 is really the renamed 12.2.0.2 in the new versioning system)

              • Using Oracle Linux Docker images has the advantage that it will download and install the 18.3 Instant Client without you having to manually do the download.


              See this blog for info about the 'slim' Oracle Linux container it uses.






              share|improve this answer




























                1












                1








                1







                I'd recommend using an operating system supported by Oracle, thus avoiding the headache of hacking Alpine and the uncertainty that it won't fall over at a critical time. And thus giving you some confidence your business won't be negatively impacted. Try https://github.com/oracle/docker-images/tree/master/OracleInstantClient



                Other comments




                • Don't set ORACLE_HOME when using Instant Client. That variable is
                  for full software installs.

                • Use ldconfig to set the system library path, see
                  the Instant Client installation instructions e.g. here.

                • Use Instant Client 18.3, which can connect to the same DB versions that 12.2 can. (18.3 is really the renamed 12.2.0.2 in the new versioning system)

                • Using Oracle Linux Docker images has the advantage that it will download and install the 18.3 Instant Client without you having to manually do the download.


                See this blog for info about the 'slim' Oracle Linux container it uses.






                share|improve this answer















                I'd recommend using an operating system supported by Oracle, thus avoiding the headache of hacking Alpine and the uncertainty that it won't fall over at a critical time. And thus giving you some confidence your business won't be negatively impacted. Try https://github.com/oracle/docker-images/tree/master/OracleInstantClient



                Other comments




                • Don't set ORACLE_HOME when using Instant Client. That variable is
                  for full software installs.

                • Use ldconfig to set the system library path, see
                  the Instant Client installation instructions e.g. here.

                • Use Instant Client 18.3, which can connect to the same DB versions that 12.2 can. (18.3 is really the renamed 12.2.0.2 in the new versioning system)

                • Using Oracle Linux Docker images has the advantage that it will download and install the 18.3 Instant Client without you having to manually do the download.


                See this blog for info about the 'slim' Oracle Linux container it uses.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 14 '18 at 7:47

























                answered Nov 13 '18 at 23:31









                Christopher JonesChristopher Jones

                1,8731615




                1,8731615






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53263972%2foracle-on-alpine-linux%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Full-time equivalent

                    さくらももこ

                    13 indicted, 8 arrested in Calif. drug cartel investigation