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:
- Put the driver file in your PHP extension directory.
- Modify the php.ini file to include the driver. For example:
extension=php_sqlsrv_53_nts_vc9.dll
- Restart Apache
Then, verify the installation using phpinfo()
.
Reference: TechNet
Related Topics
Call ASP.NET Web Service from PHP with Multiple Parameters
How to Get a Service from the Container Directly, If I Didn'T/Couldn't Inject the Service Using Di
How to Properly Display Chinese Characters in PHP
How to Trigger Xdebug Profiler for a Command Line PHP Script
Need Guidance to Start with Zend Acl
Shuffles Random Numbers with No Repetition in JavaScript/Php
How to Send Laravel Error Responses as JSON
Easy Login Script Without Database
Session_Start() Creates New Session Every Refresh
What Rss Parser Should I Use in PHP
Sort Array by Length and Then Alphabetically
How Add Custom Validation Rules When Using Form Request Validation in Laravel 5
Send Email from Localhost with Gmail(Windows)