Xampp php 5.6 mssql_connect() Fatal error: Call to undefined function mssql_connect()
Xampp php 5.6 mssql_connect() Fatal error: Call to undefined function mssql_connect()
我正在使用 Xampp 和 PHP 5.6 版。我试图使用 mssql
PHP 扩展中的 mssql_connect()
函数进行连接。但它告诉我错误:
mssql_connect() Fatal error: Call to undefined function
mssql_connect()
有人可以帮我吗?
提前致谢
说明:
MSSQL extension(mssql_
函数)在 Windows 上不再可用 PHP 5.3 或更高版本。
Warning This feature was REMOVED in PHP 7.0.0.
Alternatives to this feature include: PDO_SQLSRV PDO_ODBC SQLSRV
Unified ODBC API These functions allow you to access MS SQL Server
database.
This extension is not available anymore on Windows with PHP 5.3 or
later.
解法:
您可以安装 PHP Driver for SQL Server。您需要下载此驱动程序的适当版本。对于 PHP 5.6 - 版本 3.2(32 位或 64 位也取决于 PHP 版本)。同时下载并安装适当的 ODBC 驱动程序。
示例脚本:
<?php
$serverName = "server\instance,port";
$connectionInfo = array(
"UID" => "username",
"PWD" => "password",
"Database" => "database"
);
$conn = sqlsrv_connect($serverName, $connectionInfo);
if ($conn === false) {
echo "Unable to connect.</br>";
exit;
} else {
echo "Connected.</br>";
}
// Other code here ...
sqlsrv_close($conn);
?>
我正在使用 Xampp 和 PHP 5.6 版。我试图使用 mssql
PHP 扩展中的 mssql_connect()
函数进行连接。但它告诉我错误:
mssql_connect() Fatal error: Call to undefined function mssql_connect()
有人可以帮我吗?
提前致谢
说明:
MSSQL extension(mssql_
函数)在 Windows 上不再可用 PHP 5.3 或更高版本。
Warning This feature was REMOVED in PHP 7.0.0.
Alternatives to this feature include: PDO_SQLSRV PDO_ODBC SQLSRV Unified ODBC API These functions allow you to access MS SQL Server database.
This extension is not available anymore on Windows with PHP 5.3 or later.
解法:
您可以安装 PHP Driver for SQL Server。您需要下载此驱动程序的适当版本。对于 PHP 5.6 - 版本 3.2(32 位或 64 位也取决于 PHP 版本)。同时下载并安装适当的 ODBC 驱动程序。
示例脚本:
<?php
$serverName = "server\instance,port";
$connectionInfo = array(
"UID" => "username",
"PWD" => "password",
"Database" => "database"
);
$conn = sqlsrv_connect($serverName, $connectionInfo);
if ($conn === false) {
echo "Unable to connect.</br>";
exit;
} else {
echo "Connected.</br>";
}
// Other code here ...
sqlsrv_close($conn);
?>