无法将 PHP 连接到 Azure MS SQL Server 数据库



>有谁知道如何将php网站连接到Azure 上的MS SQL Server数据库?目前我使用的是OSX Sierra 10.12.4,MAMP ver 4.1.1和php7.1.1。

$serverName = "your_server.database.windows.net";
$connectionOptions = array(
"Database" => "your_database",
"Uid" => "your_username",
"PWD" => "your_password"
);
$conn = sqlsrv_connect($serverName, $connectionOptions);

我收到错误: 致命错误:未捕获错误:调用未定义的函数 sqlsrv_connect((

有谁知道我需要安装什么软件包?

您似乎尚未在计算机上安装 SQL Server 的Microsoft PHP 驱动程序。可以在自述文件中找到分步安装说明:https://github.com/Microsoft/msphpsql

Mac OS X

brew tap microsoft/mssql-preview https://github.com/Microsoft/homebrew-mssql-preview
brew update
brew install msodbcsql
brew install mssql-tools
brew install autoconf

最新更新