Fatal Error: Call to Undefined Function SQLsrv_Connect() in C:\Xampp\Htdocs

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

Sample Image


  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.

Uncaught Error: Call to undefined function sqlsrv_connect()

1) php_sqlsrv_72_ts_x64 AND php_pdo_sqlsrv_72_ts_x64 should be 32 bit same as xampp

2) Also compatible with PHP version

Call to undefined function sqlsrv_connect() - Troubleshooting

You have added the PDO variant of SQLSRV drivers to the extension list, but have not added the base drivers php_sqlsrv_55_ts.dll.

Add to the php.ini:

extension=php_sqlsrv_55_ts.dll

or

extension=php_sqlsrv_55_nts.dll

Also, you really should be using either the Thread-Safe (_ts.dll) or Non-Thread-Safe (_nts.dll) versions of the driver, not both. I believe that, as you are using an Apache Server, you should be using the Thread-Safe versions. So you php.ini should have:

extension=php_sqlsrv_55_ts.dll
extension=php_pdo_sqlsrv_55_ts.dll


Related Topics



Leave a reply



Submit