简体   繁体   English

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

[英]can't connect php to azure ms sql server database

Does anyone know how to connect a php website to ms sql server database on azure? 有谁知道如何在azure上将php网站连接到ms sql服务器数据库? Currently I'm using OSX Sierra 10.12.4, MAMP ver 4.1.1, and php7.1.1. 目前,我正在使用OSX Sierra 10.12.4,MAMP 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);

Im getting the error: Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect() 即时通讯收到错误:致命错误:未捕获的错误:调用未定义函数sqlsrv_connect()

does anyone know what packages I need to install? 有谁知道我需要安装哪些软件包?

It seems that you haven't installed Microsoft PHP drivers for SQL Server on your machine. 看来您的计算机上尚未安装SQL Server的Microsoft PHP驱动程序。 The step by step installation instructions can be found in the Readme file: https://github.com/Microsoft/msphpsql 可以在自述文件中找到分步安装说明: https : //github.com/Microsoft/msphpsql

Mac OS X 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 

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

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