Error "Call to Undefined Function sqlsrv_Connect"
-
2012년 3월 2일 금요일 오후 4:05
I have installed Microsoft drivers for MSSQL for connecting through php, Places the php_sqlsrv_53_ts_vc9.dll in the php extensions directory, Also have checked it from thr php extensions. But when i execute the following code, it gives error "Call to undefined function sqlsrv_Connect".
<?php
$serverName = "(local)";
$connectionInfo = array( "Database"=>"test");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn )
{
echo "Connection established.\n";
}
else
{
echo "Connection could not be established.\n";
die( print_r( sqlsrv_errors(), true));
}
sqlsrv_close( $conn);
?>I am using Windows 7, Wamp Server 2.2d, and php 5.3.10
Please any body help.
madeeha
- 편집됨 madeeha rehman 2012년 3월 2일 금요일 오후 4:07
모든 응답
-
2012년 3월 2일 금요일 오후 6:44중재자
Madeeha-
With Apache, you should be using the VC6 build of the driver. So try installing/enabling php_sqlsrv_53_ts_vc6.dll and let us know what happens.
-Brian
This posting is provided "AS IS" with no warranties, and confers no rights. http://blogs.msdn.com/brian_swan
-
2012년 3월 2일 금요일 오후 7:18Same Error, "Call to undefined function sqlsrv_connect"
madeeha
-
2012년 3월 2일 금요일 오후 7:21중재자
OK. Have you enabled the driver in your php.ini file?
extension = php_sqlsrv_53_ts_vc6.dll
And, you are using a thread-safe version of PHP, right?
-Brian
This posting is provided "AS IS" with no warranties, and confers no rights. http://blogs.msdn.com/brian_swan
-
2012년 3월 2일 금요일 오후 7:25
yes i have enabled the extension in php.ini file..
And really i dont know if i m using a thread safe or non thread safe, i m using Wamp server 2.2d, php 5.3.10, and apache 2.2.21
madeeha
-
2012년 3월 2일 금요일 오후 7:33중재자
Look at the output of phpinfo. The Thread Safety property (enabled/disabled) will tell you about thread safety. If the sqlsrv extension is loading correclty, there should also be a section that shows configuration information. If that section isn't in the output, you'll need to check your PHP error log to get more detail about why the extension isn't loading.
Hope that helps.
-Brian
This posting is provided "AS IS" with no warranties, and confers no rights. http://blogs.msdn.com/brian_swan
- 편집됨 Brian Swan - MSFTMicrosoft Employee, Moderator 2012년 3월 2일 금요일 오후 7:34
-
2012년 3월 2일 금요일 오후 7:39
Thread Safety is enabled, And there is no section for msSqlsrv...
And the Visual C++ 8.0 compiler , MSVC9
Should i use vc9 or vc6
madeeha
-
2012년 3월 2일 금요일 오후 7:51중재자
That's interesting. The windows.php.net site says specifically that you should use the VC6 version of PHP with Apache. I'm not sure why the VC9 version of PHP is being installed with WAMP.
The compiler version for PHP should match that of the driver. I would suggest manually installing PHP and manually configuring Apache or IIS. That way, you can make sure you have the right version of everything you need.
-Brian
This posting is provided "AS IS" with no warranties, and confers no rights. http://blogs.msdn.com/brian_swan
- 답변으로 제안됨 Jonathan GuerinMicrosoft Employee 2012년 3월 5일 월요일 오후 8:08
- 답변으로 표시됨 Jonathan GuerinMicrosoft Employee 2012년 3월 7일 수요일 오후 8:36
-
2012년 3월 6일 화요일 오후 3:48
There is a VC9 version of Apache available, I use it myself. The WAMP people have probably built their own.
- Please check whether you have installed WAMP 64 bit. You need to install WAMP 32 bit, not WAMP 64 bit.
If you need more help, please post the following information:
- The top panels of your phpinfo, up to and including "apache2handler" section
- The extensions section of php.ini
Rob

