Fatal error: Call to undefined function sqlsrv_connect() in C:\xampp\htdocs

The MSSQL extension is not available anymore on Windows with PHP 5.3 or later. SQLSRV, an alternative driver for MS SQL is available from Microsoft: » http://www.microsoft.com/en-us/download/details.aspx?id=20098

Step by Step

  1. Download SQLSRV32.EXE (Microsoft Drivers for PHP for SQL Server) from: http://www.microsoft.com/en-us/download/details.aspx?id=20098

  2. Choose path: C:\xampp\php\ext

enter image description here

  1. Uncomment or Append extension = php_sqlsrv_56_ts.dll in php.ini

  2. Restart Apache from XAMPP Control Panel (Stop/Start)

I tested it and it works 100%

You can find the most recent compiled binaries in the official Microsoft Git repository.


I followed Lea Tano guide and didn't work. I needed a fer more steps. At least for Windows7 (or for my system) there're some missing steps(ie those who don't have MSSQL Server installed in the same server/machine).

Here's how i made it work:

  1. Follow Lea Tano guide to install SQLSRV 5.6 (or 5.3 or..)
  2. Download and install the OBDC Driver 11 (msodbcsql.msi)
  3. Download and install the SQL Server Native Client (sqlncli.msi file)
  4. Check if installed (if not, download and install) Visual C++ Redistributable VS2012 Update4 (vcredist_x86.exe)

Lea's answer should do the trick for you. It is very important that you download PHP 5.6 from the Web PI - https://www.microsoft.com/web/downloads/platform.aspx

Make sure to use IE when you download the Web PI to your machine.