3

How can I connect to a SQL Server using Windows authentication and the native SQL driver, when the PHP code is executed on a Linux machine under Apache or PHP-FPM ?

https://learn.microsoft.com/en-us/sql/connect/php/how-to-connect-using-windows-authentication?view=sql-server-2017

The credentials under which the Web server's process (or thread) is running must map to a valid SQL Server login in order to establish a connection.

So basically the question is how to do this with Linux/Apache/PHP-FPM ?

inckie
  • 191
  • 3
  • 12
  • As far as I know you need to compile PHP with LDAP. http://php.net/manual/en/book.ldap.php – Pinke Helga Feb 11 '19 at 23:24
  • Possible duplicate of [Using windows authentication with php?](https://stackoverflow.com/questions/2501729/using-windows-authentication-with-php) – Pinke Helga Feb 11 '19 at 23:28
  • https://stackoverflow.com/questions/35077694/php-ldap-windows-authentication – Pinke Helga Feb 11 '19 at 23:29
  • This is not quite what I'm asking about - I wan't to connect to a SQL Server, that requires Windows authentication, not to authenticate users against an active directory. – inckie Feb 12 '19 at 00:08

1 Answers1

0

The answer to this question is to use kerberos and a keytab file to store the Windows user credentials and use something like k5start to acquire and renew the kerberos ticket automatically.

This link Connection problem Linux Apache+PHP to MS SQL Server using WindowsAuth / Kerberos ("No Kerberos credentials available") answers the PHP/Apache related part of this question.

inckie
  • 191
  • 3
  • 12