Open andremartinez opened 1 year ago
I'm not sure what's happening at a glance, but does /usr/lib/x86_64-linux-gnu/libltdl.la
exist? And if so, what are the contents of it? If it doesn't then there maybe some issue with libltdl-dev
installation (it's supposed to come from that package)
Hello @v-makouz , answering:
I'm not sure what's happening at a glance, but does
/usr/lib/x86_64-linux-gnu/libltdl.la
exist? And if so, what are the contents of it?
I double checked it now, and no It's not present
If it doesn't then there maybe some issue with
libltdl-dev
installation (it's supposed to come from that package)
I tried the workaround suggested here (#1436 installing the version 2.3.7 of unixodbc-dev) and it worked, so my guess is that this library installs libltdl-dev
and the most recent version of either of them got rid of .la files.
What I have no idea about is how these files are related to the process of compiling sqlsrv
and pdo_sqlsrv
, but as I said I tried to compile the sqlsrv.so
locally and got this same error
Appears to be a new issue caused by something being upgraded in the last couple of days. Hopefully it gets reverted as the fix in #1436 breaks the script for ARM processors (the bug hasn't affected ARM). If this change is here to stay it will require different install scripts for ARM and AMD for myself and many others.
edit The below works for both CPU architectures and means if they fix the issue it'll go back to using unixodbc-dev like before.
ACCEPT_EULA=Y apt-get install -y msodbcsql18 mssql-tools18 unixodbc-dev && \
pecl install sqlsrv pdo_sqlsrv || \
apt-get install -y --allow-downgrades odbcinst=2.3.7 odbcinst1debian2=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7 && \
pecl install sqlsrv pdo_sqlsrv
I used the fix here https://github.com/microsoft/msphpsql/issues/1436#issuecomment-1428075290
@alexryall
Thanks for the allow-downgrades tip!!
Built Docker image for Debian 11 with PHP 8.1 and 8.2 with pdo_sqlsrv-5.11.0. Below my two cent contribution, the Dockerfile links. Please note, I have not tested the connection to the database.
Can't believe this still hasn't been fixed yet months later
Can't believe this still hasn't been fixed yet months later
I tested with php:8.1-apache today and can't reproduce the error. What's the error message you get?
I'm having the same issue today on Ubuntu 22.04 (with PHP 8.1).
Following code did install the pdo_server in ubuntu 22.04 for me
ENV ACCEPT_EULA=Y
RUN curl -s https://packages.microsoft.com/keys/microsoft.asc | tee /etc/apt/trusted.gpg.d/microsoft.asc | apt-key add - \
&& curl -s https://packages.microsoft.com/config/ubuntu/22.04/prod.list | tee /etc/apt/sources.list.d/mssql-release.list > /etc/apt/sources.list.d/mssql-release.list
RUN apt-get update
# install MS ODBC 18
# https://docs.microsoft.com/pt-br/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-2017#debian18
RUN apt-get -y install msodbcsql18 mssql-tools18
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
RUN echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
RUN exec bash
# https://github.com/microsoft/msphpsql/issues/1438#issuecomment-1444773949
RUN apt-get install -y --allow-downgrades odbcinst=2.3.7 odbcinst1debian2=2.3.7 unixodbc=2.3.7 unixodbc-dev=2.3.7
#RUN apt-get -y install unixodbc unixodbc-dev
RUN apt-get -y install gcc g++ make autoconf libc-dev pkg-config
##------------ Install Drive 5.10.1 for SQL Server -----------
# List version drive PDO https://pecl.php.net/package/pdo_sqlsrv
# Install Drive: https://docs.microsoft.com/pt-br/sql/connect/php/installation-tutorial-linux-mac?view=sql-server-2017
RUN apt-get install php-pear
RUN pecl install sqlsrv-5.11.0 && echo "extension=sqlsrv.so" > /etc/php/8.2/mods-available/sqlsrv.ini && \
pecl install pdo_sqlsrv-5.11.0 && echo "extension=pdo_sqlsrv.so" > /etc/php/8.2/mods-available/pdo_sqlsrv.ini && \
phpenmod sqlsrv pdo_sqlsrv
PHP version
Tested for PHP within docker images php:8.1-apache and php:8.2-apache
PHP SQLSRV or PDO_SQLSRV version
Both stable (5.10.1) sqlsrv pdo_sqlsrv and beta (5.11.0beta1) sqlsrv pdo_sqlsrv
Microsoft ODBC Driver version
Versions msodbcsql18 and msodbcsql17 for ubuntu/20.04
Problem description
Installation in a Dockerfile using pecl is failing with the following message:
This problem is very likely to be related to the issue https://github.com/microsoft/msphpsql/issues/1436 as the workaround mentioned there (using specific versions for some libraries) works for me as well
Expected behavior and actual behavior
Another test I ran was to try and compile the extension, the steps were:
apt-get update && apt-get install -y unixodbc-dev libltdl-dev libodbc1
The error message at this point is exactly the same.
Repro code or steps to reproduce
Create a Dockerfile with the following content then build it: