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
Download SQLSRV32.EXE (Microsoft Drivers for PHP for SQL Server) from: http://www.microsoft.com/en-us/download/details.aspx?id=20098
Choose path: C:\xampp\php\ext
Uncomment or Append
extension = php_sqlsrv_56_ts.dll
inphp.ini
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
Laravel - Form Input - Multiple Select for a One to Many Relationship
Laravel 5.5 Error 500 in Cpanel Shared Hosting
How to Remove a Key from an Object Not Array in Laravel
How to Export Data in Multiple Sheets in PHP
Increase a Value Like = +1 in MySQL and PHP
Contact Form 7 Cause Http 500 Error
Unable to Upload File Greater Than 2Mb in Laravel
Symfony: an Exception Occured in Driver: Could Not Find Driver With MySQL
How to Pass Checkbox Value 0 If Not Checked and 1 If Checked Using Array Laravel
Laravel: Property [Name] Does Not Exist on This Collection Instance
How to Get Part of Url Before Last Slash With PHP
Update Database After Select Option Change
Disable Xampp Redirect Http to Https
Php: Fastest Way to Handle Undefined Array Key
How to Call Function of One PHP File from Another PHP File and Pass Parameters to It