简体   繁体   English

通过PHP连接到MSSQL Server

[英]Connect to MSSQL Server via PHP

I have MSSQL 2008 installed on my production server. 我的生产服务器上安装了MSSQL 2008。 I want to operate on that data remotely via php. 我想通过php对该数据进行远程操作。 As I went through a lot of articles and installed 'php_sqlsrv_54_ts.dll' and 'php_sqlsrv_54_nts.dll' files in my ext folder and enable them in my php.ini file. 在阅读大量文章并在ext文件夹中安装了“ php_sqlsrv_54_ts.dll”和“ php_sqlsrv_54_nts.dll”文件后,在我的php.ini文件中启用了它们。 But still I am getting following error: 但仍然出现以下错误:

Fatal error: Call to undefined function mssql_connect()... 致命错误:调用未定义的函数mssql_connect()...

Please help me out how could I do this? 请帮助我,我该怎么做?

php_sqlsrv_54_ts is not the extension files for the mssql extension, which is no longer supported when connecting from PHP hosted on Windows. php_sqlsrv_54_ts不是mssql扩展的扩展文件,当从Windows上托管的PHP连接时不再支持该扩展文件。 php_sqlsrv_54_ts is for SQLSRV and you need to connect using sqlsrv_connect . php_sqlsrv_54_ts适用于SQLSRV ,您需要使用sqlsrv_connect进行连接。

Just in case the above is less than clear... You have the right extension installed, meaning the one that is newer and preferred. 以防万一上述内容还不清楚...您已安装了正确的扩展名,即较新的和首选的扩展名。 You are using the wrong functions. 您使用了错误的功能。 You don't need to, nor should you, try to enable the mssql extension. 您不需要,也不应该尝试启用mssql扩展。 You simple need to use the sqlsrv extension functions instead. 您只需要使用sqlsrv扩展功能即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM