Fatal Error: Call to Undefined Function Sqlsrv_Connect()

Fatal error: Call to undefined function sqlsrv_connect()

This helped me get to my answer. There are two php.ini files located, in my case, for wamp. One is under the php folder and the other one is in the C:\wamp\bin\apache\Apachex.x.x\bin folder. When connecting to SQL through sqlsrv_connect function, we are referring to the php.ini file in the apache folder. Add the following (as per your version) to this file:

extension=c:/wamp/bin/php/php5.4.16/ext/php_sqlsrv_53_ts.dll

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

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.

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



Related Topics



Leave a reply



Submit