0

I'm setting up a docker container with PHP8 and OCI8. can't seem to figure out why i'm getting error

PHP message: PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_oci.so' (tried: /usr/lib/php8/modules/pdo_oci.so (Error loading shared library /usr/lib/php8/modules/pdo_oci.so: No such file or directory), /usr/lib/php8/modules/pdo_oci.so.so (Error loading shared library /usr/lib/php8/modules/pdo_oci.so.so: No such file or directory)) in Unknown on line 0

is there anyway to check the files inside the docker container?

already unzip the Oracle Instant Client, but im now sure its in the directory.

this is my Dockerfile for reference:

    FROM composer:2.0 as vendor

COPY composer.json/ /app/composer.json
COPY docker/config/nginx.conf /app/nginx.conf

RUN composer install \
    --ignore-platform-reqs \
    --no-interaction \
    --no-plugins \
    --no-scripts \
    --no-ansi \
    --prefer-dist


FROM php:8.0-fpm-alpine3.13
LABEL  Maintainer="Christian Jay Bayno"

# Install packages
RUN apk --no-cache add php8 \
php8-fpm \
php8-pdo_mysql \
php8-json \
php8-openssl \
php8-curl \
php8-tokenizer \
php8-dom \
php8-dev \
php8-opcache \
nginx \
supervisor \
curl \
git \
tzdata \
g++ \
gcc \
make \
libaio-dev \
libnsl \
gcompat

RUN ln -s /usr/lib/libnsl.so.2 /usr/lib/libnsl.so.1

# Install Instaclient and PDO OCI
RUN mkdir -p /opt/oci

COPY ./docker/oracle/instantclient-basic-19.17.0.0.0.zip /opt/oci
COPY ./docker/oracle/instantclient-sdk-19.17.0.0.0.zip /opt/oci
COPY ./docker/oracle/pdo_oci.zip /opt/oci
RUN cd /opt/oci \
    && unzip instantclient-basic-19.17.0.0.0.zip \
    && unzip instantclient-sdk-19.17.0.0.0.zip \
    && cd instantclient_19_17/ \
    && ln -s /opt/oci/instantclient_19_17/libclntsh.so.19.1 libclntsh.so \
    && ln -s /opt/oci/instantclient_19_17/libocci.so.19.1 libocci.so \
    && ls \ 
    && cd ../ \
    && unzip pdo_oci.zip \
    && cd pdo_oci \
    && phpize \
    && ./configure --with-pdo-oci=shared,instantclient,/opt/oci/instantclient_19_17 \
    && make \
    && make install \
    && echo "extension=pdo_oci.so" >> /etc/php8/conf.d/pdo_oci.ini \
    && cd /opt/oci \
    && rm *.zip

# Configure Timezone
ENV TZ Asia/Manila

# Configure nginx
COPY docker/config/nginx.conf /etc/nginx/nginx.conf

# Configure PHP-FPM
  COPY docker/config/fpm-pool.conf /etc/php8/php-fpm.d/www.conf
  COPY docker/config/php.ini /etc/php8/conf.d/app.ini

# Configure supervisord
COPY docker/config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf

# Make sure files/folders needed by the processes are accessable when they run under the nobody user
RUN chown -R nobody.nobody /run && \
  chown -R nobody.nobody /var/lib/nginx && \
  chown -R nobody.nobody /var/log/nginx

# Set up document root
RUN mkdir -p /var/www/html

# Switch to use a non-root user from here on
USER nobody

# Add application
WORKDIR /var/www/html
COPY --chown=nobody . /var/www/html/
COPY --chown=nobody --from=vendor /app/vendor/ /var/www/html/vendor/

# Expose the port nginx is reachable on
EXPOSE 8085

# Let supervisord start nginx & php-fpm
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

# Configure a healthcheck to validate that everything is up&running
HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8085/fpm-ping

enter image description here

Vincent Dapiton
  • 587
  • 1
  • 9
  • 27
  • Im not sure, but `&& phpize` can point to the wrong php version. So better use `&& /usr/bin/phpize8` directly. Test it. – Foobar Dec 22 '22 at 08:58
  • Also `./configure --with-php-config=/usr/bin/php-config8` – Foobar Dec 22 '22 at 09:00
  • add this `./configure --with-php-config=/usr/bin/php-config8` below `&& /usr/bin/phpize8` right? – Vincent Dapiton Dec 22 '22 at 09:06
  • `checking if that is sane... configure: error: You need to tell me where to find your Oracle Instant Client SDK, or set ORACLE_HOME. ` got this error after updating it – Vincent Dapiton Dec 22 '22 at 09:10
  • Did you remove `--with-pdo-oci=shared,instantclient,/opt/oci/instantclient_19_17`? Keep it. `./configure --with-php-config=... --with-pdo-oci=...` – Foobar Dec 22 '22 at 09:13
  • didnt remove anythig. just updated the `&& /usr/bin/phpize8` and added `./configure --with-php-config=/usr/bin/php-config8` . will try to update the `./configure` too. – Vincent Dapiton Dec 22 '22 at 09:22
  • Also take lool at this answer: https://stackoverflow.com/a/72609720/19625365 Put the `RUN ..` line after your `ln -s` in the Dockerfile. But read the hole Question & Answers, may that helps – Foobar Dec 22 '22 at 09:22
  • still no luck . updated the error message for more reference – Vincent Dapiton Dec 22 '22 at 10:04
  • Last tip (not a chat here:-)): You can add the absolute path in `/etc/php8/conf.d/pdo_oci.ini` like `extension=/path/to/pdo_oci.so`. If that not works, then it is not installed correct. Then you should watch the output when doing `docker --build` to locate the issue. – Foobar Dec 22 '22 at 10:11
  • not sure if it relates but there is `./Configure: line 1: usr/bin/file: not found` – Vincent Dapiton Dec 22 '22 at 10:51
  • https://stackoverflow.com/questions/41946584/autoconf-configure-warning-usr-bin-file-no-such-file-or-directory – Foobar Dec 22 '22 at 11:14

0 Answers0