Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

584
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda