1

I keep getting this error when I run my code:

Call to undefined function sqlsrv_connect().

I am using XAMPP, PHP 7.0, and SQL server. All the answers I found on how to fix this involves downloading the drivers.

I have installed in XAMPP/ PHP/ EXT folder:

  • php_pdo_sqlsrv_54_ts.dll
  • as well as 55 and 56
  • php_sqlsrv_54_ts.dll
  • as well as 55 and 56

and also the same for all of them with .nts instead of .ts. I also have in my php.ini folder thats located in my XAMPP/ PHP folder, the extensions to all these files. These are all the drivers I have tried and that haven't worked for me so far.

Any ideas on why this isn't working for me? Is it because the drivers are overlapping and causing a problem, or do I have the wrong ones downloaded?

DennisOakdale
  • 39
  • 2
  • 8
  • Possible duplicate of [Fatal error: Call to undefined function sqlsrv\_connect()](http://stackoverflow.com/questions/22015179/fatal-error-call-to-undefined-function-sqlsrv-connect) – Machavity May 12 '16 at 22:20
  • I can't find any [documentation](https://msdn.microsoft.com/en-us/library/cc296170.aspx) that shows it's supported with php7. [this page](https://www.microsoft.com/en-us/download/details.aspx?id=20098) says they "are PHP 5 extensions" – Jeff Puckett May 12 '16 at 22:31

1 Answers1

0

It can't work because you're trying to use sqlsrv driver for PHP 5. Driver for PHP7 is in early technical preview stage and you can find it here https://github.com/Azure/msphpsql/tree/PHP-7.0. Look at install section in readme and don't forget install Microsoft ODBC driver for SQL server.

kba
  • 4,190
  • 2
  • 15
  • 24