Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

587
Visualizações
Is there any specific setting for connecting to SQL Server through PHP on Linux CentOS 7

I have already done this through Windows machine but getting error on Linux. I have been searching for the similar issues and implementing all I could get, but still no luck.

I am trying to connect SQL server on following environment: Microsoft SQL Server 2016, Linux Centos 7.9.2009, PHP 7.3.29, ODBC Driver 13 and 17

I have already install and enable the PDO_ODBC and pdo_sqlsrv, confirmed through phpinfo.

Below is my connection string:

$conn = new PDO("odbc:Driver={ODBC Driver 13 for SQL Server};SERVER=192.168.99.237;Port:24115;Database=dbname;Uid=username;Pwd=password;")

also tried

$conn = new PDO("odbc:Driver={ODBC Driver 13 for SQL Server};SERVER=192.168.99.237,24115;Database=dbname;", "username", "password")

and the error is

SQLSTATE[HYT00] SQLDriverConnect: 0 [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired

Updated code and findings:

I am able to connect via cli:

isql MSSQL username password
tsql -S MSSQL -U 'username' -P 'password'
osql -S mssql -U username -P password

While trying through below PHP connection string, getting 'could not find driver'

new PDO("dblib:host=mssql;dbname=database", "username", "password");
over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda