Msphpsql: tcp provider: error code 0x2746

Created on 11 Apr 2020  路  3Comments  路  Source: microsoft/msphpsql

Client

PHP version

  • 7.3

Microsoft ODBC Driver version

  • msodbcsql 17

OS

Openssl version

  • tested with 1.1.1d, 1.0.2k, 1.0.1e but still get the same error

Server

SQL Server version

  • SQL 2005 sp4 standard edition

OS

  • Windows server 2003

I'm trying connect my laravel application on linux to a sql 2005 but i've got this error

image

and i got to know it's a matter of ssl connection so i've tested with downgraded openssl but i still can't solve this problem

as far as i know the matter is that Client and Server's ssl version doesn't match
and sql 2005 does not support TLS1.2 so i downgraded openssl version on linux but still didn't work.

and on local (windows10) everything works fine but on linux i have been suffering with this error.

let me show you the connection packet (Microsoft Message Analyzer used)
laravel on windows 10 With SQL 2005 on windows server 2003
image
at first client tries to connect with TLS1.2 and then seems like it negotiates with the server and
agrees on using TLS1.0.
everyhintg works fine

laravel on linux(ubuntu 18.0.4 and centos7) With SQL 2005 on windows server 2003
image

although i downgraded the openssl version and configured it to use TLS1.0 only but
it still seems like it still using TSL1.2 and is not negotiable.

in addition i found something strange in packet between docker on windows10 and sql2005 on windows sever 2003
image

on records
indicates TLS1.0

but in the fragment - body
indicates TLS1.2

i'm confused which ssl version is actullay used and don't understand why the connection can't proceed.

and this is my docker file

FROM php:7.3-fpm

RUN apt-get update && apt-get install -y \
    build-essential \
    libpng-dev \
    libjpeg62-turbo-dev \
    libfreetype6-dev \
    locales \
    zip \
    libzip-dev \
    jpegoptim optipng pngquant gifsicle \
    vim \
    unzip \
    git \
    wget \
    curl

RUN apt-get update && apt-get install -my wget gnupg

RUN apt-get update \
    && curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - \
    && curl https://packages.microsoft.com/config/debian/9/prod.list \
        > /etc/apt/sources.list.d/mssql-release.list \
    && apt-get install -y --no-install-recommends \
        locales \
        apt-transport-https \
    && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
    && locale-gen \
    && apt-get update \
    && apt-get -y --no-install-recommends install \
        unixodbc \
        unixodbc-dev \
        msodbcsql17

RUN apt-get clean && rm -rf /var/lib/apt/lists/*

RUN docker-php-ext-install pdo pdo_mysql mbstring exif pcntl
RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-install gd

RUN pecl install sqlsrv pdo_sqlsrv \
    && docker-php-ext-enable sqlsrv pdo_sqlsrv

WORKDIR /usr/local/src/
RUN wget https://www.openssl.org/source/old/1.0.2/openssl-1.0.2k.tar.gz \
    && tar -xvzf openssl-1.0.2k.tar.gz \
    && cd openssl-1.0.2k \
    && ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib \
    && make \
    && make install

RUN cd /etc/ld.so.conf.d/ \
    && echo /usr/local/ssl/lib > openssl-1.0.2k.conf \
    && echo PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/ssl/bin" > /etc/environment \
    && source /etc/environment

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

EXPOSE 9000
CMD ["php-fpm"]

and in this case
Linux is the client
so i want to specify which SSL version it should use like windows
like following
image
i can enable SSL when windows is a client or a server

how can i do it on linux?

Most helpful comment

252 TCP Provider: Error code 0x2746. Client unable to establish connection

this solved my problem
and Thanks yitam :D

All 3 comments

@dkrdj8989 for your information we no longer support Windows server 2003 and SQL 2005 sp4

252 TCP Provider: Error code 0x2746. Client unable to establish connection

this solved my problem
and Thanks yitam :D

@dkrdj8989 I am having the same issue
Could I please request your updated Dockerfile after the fix so I can isolate what you changed?
My Dockerfile is similar to your initial one.
Thanks!

Was this page helpful?
0 / 5 - 0 ratings