mssql_connect 从 PHP 5.3 开始不再工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11244470/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 00:04:51  来源:igfitidea点击:

mssql_connect no longer working as of PHP 5.3

phpsql-serversql-server-2005php-5.3deprecated

提问by JCraine

I just received an email from our host and they've upgraded our PHP to 5.3, unfortunately though, all the scripts have now broken. I traced it down to the function mssql_connectfailing. Support told me this has now been deprecated under 5.3 - how can this be true?

我刚刚收到来自我们主机的电子邮件,他们已将我们的 PHP 升级到 5.3,但不幸的是,所有脚本现在都已损坏。我将其追溯到函数mssql_connect失败。支持人员告诉我这在 5.3 下已被弃用 - 这怎么可能是真的?

How can you connect to a mssql database under PHP 5.3 now??

现在PHP 5.3下怎么连接mssql数据库??

采纳答案by Gabriel Baker

http://www.php.net/manual/en/intro.mssql.php

http://www.php.net/manual/en/intro.mssql.php

"This extension is not available anymore on Windows with PHP 5.3 or later."

“此扩展在使用 PHP 5.3 或更高版本的 Windows 上不再可用。”

Maybe you should look into converting your app to use PDO: http://www.php.net/manual/en/ref.pdo-sqlsrv.php

也许您应该考虑将您的应用程序转换为使用 PDO:http: //www.php.net/manual/en/ref.pdo-sqlsrv.php

回答by Lekensteyn

If you see such a warning, the first place to visit is the PHP documentation.

如果看到这样的警告,首先要访问的是PHP文档。

From http://php.net/manual/en/intro.mssql.php:

http://php.net/manual/en/intro.mssql.php

Introduction

These functions allow you to access MS SQL Server database.

This 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://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx.

介绍

这些函数允许您访问 MS SQL Server 数据库。

此扩展在使用 PHP 5.3 或更高版本的 Windows 上不再可用。

SQLSRV,Microsoft 提供的 MS SQL 替代驱动程序: ? http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx