Cannot Call Function SQLsrv_Connect()

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()

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

CodeIgniter - Call to undefined function sqlsrv_connect() - Driver seems to be loaded (PHP Version: 8.0.3)

With the help of a friendly user I found out that I made a mistake while configuring the webserver. I didn't know that there has to be a section with the name sqlsrv.

Reinstalled the driver and now everything works fine.

Call to undefined function sqlsrv_connect()

To install SQLSRV 3.0 to Apache (I assume) in Windows platform, here are the steps:

  1. Put the driver file in your PHP extension directory.
  2. Modify the php.ini file to include the driver. For example: extension=php_sqlsrv_53_nts_vc9.dll
  3. Restart Apache

Then, verify the installation using phpinfo().

Reference: TechNet



Related Topics



Leave a reply



Submit