SQLSRV 3.0安装 - 未定义函数sqlsrv_connect()IIS,php5.4.3,

时间:2013-08-09 14:50:01

标签: php windows sqlsrv

我已经阅读(并尝试过)我能找到的每一篇文章,但没有运气。 phpinfo没有显示sqlsrv,但是ext文件夹是正确的(已测试),dll也在那里。

extension=php_pdo.dll //which I don't think is actually needed for this version
extension=php_sqlsrv_53_nts.dll
extension=php_pdo_sqlsrv_53_nts.dll

它们位于c:/ PHP / ext
中 使用FastCGI,确实重启了IIS以及整个服务器 此版本的PHP(X86)和MSSQL10_50.SQLEXPRESS已经安装并且已经安装。工作了一年。

  

Windows Server 2008 R2
  PHPINFO
  编译器:MSVC9(Visual C ++ 2008)
  PHP扩展版本:API20100525,NTS,VC9

但是,在PHPINFO上,我在Configure Command上看到了这一点:

"--without-mssql" "--without-pdo-mssql" 

刚刚找到并添加:

extension=php_sqlsrv_30_53_nts_vc9x86.dll
extension=php_pdo_sqlsrv_30_53_nts_vc9x86.dll 

然后:

extension_dir="C:\PHP\ext" 

所以我知道我已经正确安装了dll

任何帮助都将非常感谢 - 到目前为止两天!

1 个答案:

答案 0 :(得分:0)

我最近升级了我的PHP和sqlsrv驱动程序。这是我为SQLSRV部分所做的:

首先,我的phpinfo()产生:

PHP Version 5.5.1
System: Windows NT HOSTNAME 6.1 build 7601 (Windows 7 Business Edition Service Pack 1) i586
Build Date: Jul 18 2013 10:37:55 
Compiler: MSVC11 (Visual C++ 2012) 
Architecture: x86 


Configure Command
cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" "--with-enchant=shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" "--with-pgo" 

然后我将SQLSRV驱动程序安装到C:\ Program Files(x86)\ PHP \ ext文件中,并添加到php.ini中:

[PHP_SQLSRV]
extension=php_sqlsrv_53_nts_vc9.dll 
[PHP_PDOSQLSRV]
extension=php_pdo_sqlsrv_53_nts_vc9.dll

它有效。尽管我没有直接调用函数(我使用Yii框架),我也改变了DSN:

  

SQLSRV:服务器= hostname_or_ip;数据库= your_database_name;

希望它有所帮助。

修改

我从http://social.msdn.microsoft.com/Forums/sqlserver/en-US/e1d37219-88a3-46b2-a421-73bfa33fe433/unofficial-php-55-drivers-x86下载了PHP 5.5的实验/非官方sqlsrv驱动程序,并将我的配置更新为:

[PHP_SQLSRV]
extension=php_sqlsrv_55_nts.dll 
[PHP_PDOSQLSRV]
extension=php_pdo_sqlsrv_55_nts.dll

发现自:https://stackoverflow.com/a/17390741/2236500