Closed robertoperuzzo closed 1 year ago
Hi @robertoperuzzo I'm afraid if you're on an M1 mac, (looks like it?) I think you're out of look; there are no resources for sqlsrv for the arm64 architecture AFAIK.
Hi @robertoperuzzo I'm afraid if you're on an M1 mac, (looks like it?) I think you're out of look; there are no resources for sqlsrv for the arm64 architecture AFAIK.
Fortunately I'm on Intel mac 2,3 GHz 8-Core Intel Core i9, so probably I will have a chance ;)
As a matter of fact, with the following Dockerfile I have the pdo_sqlsrv
installed and working.
ARG BASE_IMAGE
FROM $BASE_IMAGE
ENV PATH="${PATH}:/opt/mssql-tools/bin"
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests apt-utils curl gnupg2 ca-certificates
RUN curl -sSL -O https://packages.microsoft.com/keys/microsoft.asc
RUN apt-key add <microsoft.asc
RUN curl -sSL -o /etc/apt/sources.list.d/mssql-release.list https://packages.microsoft.com/config/debian/11/prod.list
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests \
build-essential \
dialog \
php-pear \
php8.1-dev \
unixodbc=2.3.7 \
odbcinst=2.3.7 \
odbcinst1debian2=2.3.7 \
unixodbc-dev=2.3.7 \
locales
RUN ACCEPT_EULA=Y DEBIAN_FRONTEND=noninteractive apt-get install -y msodbcsql18 mssql-tools
# Change the PHP version to what you want. It is currently set to version 8.0.
RUN pecl channel-update pecl.php.net
RUN pecl -d php_suffix=8.1 install sqlsrv
RUN pecl -d php_suffix=8.1 install pdo_sqlsrv
RUN echo 'extension=sqlsrv.so' >> "/etc/php/8.1/mods-available/sqlsrv.ini"
RUN echo 'extension=pdo_sqlsrv.so' >> "/etc/php/8.1/mods-available/pdo_sqlsrv.ini"
RUN phpenmod -v 8.1 sqlsrv pdo_sqlsrv
Please do a PR to the existing recipe then, thanks.
Note that you don't have to explicitly set the PHP version, as you can now use the variable $DDEV_PHP_VERSION
in .ddev/web-build/Dockerfile; also, the ARGs at the top are no longer needed.
@rfay we have the first release of add-on https://github.com/robertoperuzzo/ddev-sqlsrv
Awesome!
I close this issue because it is preferable to use the add-on.
Using the following Dockerfile in my project
I'm getting the error
It seems something related to unixodbc 2.3.11, because using the 2.3.7 like that
the docker image is built correctly.