I want to parse an mdb file using odbc_connect. I created a docker for this and I get this error.
Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open lib 'MDBTools' : file not found, SQL state 01000 in SQLConnect
I installed mdbtools but it doesn't work.
I put the mdb file in the /public directory.
Here is my dockerfile.
FROM php:8.2-fpm
# COMMON ---------------------------------------------------------------------------------------------------------------
# make sure apt is up to date
RUN apt-get update --fix-missing \
&& apt-get install -y \
mdbtools \
curl \
build-essential \
libssl-dev \
zlib1g-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libicu-dev \
libpq-dev \
libldap2-dev \
libzip-dev \
libxml2-dev \
libicu-dev \
vim \
debconf \
subversion \
git \
apt-transport-https \
apt-utils \
locales \
acl \
mailutils \
wget \
zip \
unzip \
gnupg \
gnupg1 \
gnupg2 \
wkhtmltopdf \
xvfb \
&& apt-get clean
# end COMMON -----------------------------------------------------------------------------------------------------------
RUN apt-get install unixodbc-dev -y --force-yes
RUN docker-php-source extract
RUN docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr/
RUN docker-php-ext-install pdo_odbc \
&& cd /usr/src/php/ext/odbc \
&& phpize \
&& sed -ri 's@^ *test +"\$PHP_.*" *= *"no" *&& *PHP_.*=yes *$@#&@g' configure \
&& ./configure --with-unixODBC=shared,/usr \
&& docker-php-ext-install odbc
# LOCALE ---------------------------------------------------------------------------------------------------------------
RUN sed -i -e 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/' /etc/locale.gen \
&& locale-gen
ENV LANG fr_FR.UTF-8
ENV LANGUAGE fr_FR:fr
ENV LC_ALL fr_FR.UTF-8
# end LOCALE -----------------------------------------------------------------------------------------------------------
# PDOSQL, IMAGICK, SOAP
RUN docker-php-ext-install \
pdo \
pdo_mysql \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl \
&& docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
&& docker-php-ext-install gd \
&& docker-php-ext-install soap \
&& docker-php-ext-configure zip --with-zip \
&& docker-php-ext-install zip \
&& docker-php-ext-install sockets
# end PDOSQL, IMAGICK, SOAP
# Imagick
RUN apt-get update && apt-get install -y libmagickwand-6.q16-dev --no-install-recommends \
&& ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/MagickWand-config /usr/bin \
&& pecl install imagick \
&& echo "extension=imagick.so" > /usr/local/etc/php/conf.d/ext-imagick.ini
# end Imagick
COPY php-fpm-pool.conf /etc/php/8.2/pool.d/www.conf
# PHP INI --------------------------------------------------------------------------------------------------------------
ARG PHP_INI=php.ini
COPY $PHP_INI /usr/local/etc/php/
# end PHP INI ----------------------------------------------------------------------------------------------------------
# PHP ODBC INST --------------------------------------------------------------------------------------------------------------
ARG ODBCINST_INI=odbcinst.ini
COPY $ODBCINST_INI /usr/local/etc/
# end PHP ODBC INST ----------------------------------------------------------------------------------------------------------
# PHP ODBC --------------------------------------------------------------------------------------------------------------
ARG ODBC_INI=odbc.ini
COPY $ODBC_INI /usr/local/etc/
# end PHP ODBC ----------------------------------------------------------------------------------------------------------
# Install composer -----------------------------------------------------------------------------------------------------
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN groupadd dev -g 1001
RUN useradd dev -g dev -d /home/dev -m
# end Install composer -------------------------------------------------------------------------------------------------
# NODE JS, YARN et PYTHON ----------------------------------------------------------------------------------------------
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update
RUN apt-get install nodejs=16.20.2-1nodesource1 -y
RUN apt-get install npm -y
RUN apt-get install unixodbc unixodbc-dev -y \
&& docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \
&& docker-php-ext-install pdo_odbc
#RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
#RUN apt-get install -y nodejs npm
# node js >= 16
RUN npm install -g corepack
RUN corepack enable
# node js < 16
#RUN npm i -g corepack
RUN yarn init -2
RUN apt-get update
RUN apt-get install python3 -y
# npm rebuild node-sass a lancer dans le bash si besoin après update (docker exec -it sf4_php bash)
# end NODE JS, YARN et PYTHON ------------------------------------------------------------------------------------------
WORKDIR /home/www
EXPOSE 9000
CMD ["php-fpm"]
Mdbtools is installed in docker.
Do you have any idea where this could come from?
Thank you for your help
