“调用未定义的函数 sqlsrv_connect()”尝试从 PHP 连接到 Azure DB 时
我正在尝试通过以下方式从 php 连接到 Azure DB
$connectionInfo = array("UID" => "xxx@xxx", "pwd" => "xxx", "Database" => "xxx");
$serverName = "tcp:xxx.database.windows.net,1433";
$conn = sqlsrv_connect($serverName, $connectionInfo);
但它给了我
致命错误:在第 19 行调用 C:\wamp\www...\index.php 中的未定义函数 sqlsrv_connect()
I'm trying to connect from php to Azure DB by
$connectionInfo = array("UID" => "xxx@xxx", "pwd" => "xxx", "Database" => "xxx");
$serverName = "tcp:xxx.database.windows.net,1433";
$conn = sqlsrv_connect($serverName, $connectionInfo);
But it gives me
Fatal error: Call to undefined function sqlsrv_connect() in C:\wamp\www...\index.php on line 19
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须首先使用用于 php 的 SQL Server 本机驱动程序 ,那么您可以执行以下操作:
您可以在以下博客文章中阅读有关 PHP 和 SQL Azure 的更多信息:
http://博客。 msdn.com/b/brian_swan/archive/2010/02/12/getting-started-with-php-and-sql-azure.aspx
you have to use the SQL Server native driver for php at first place, then you can do something like:
You can read more on PHP and SQL Azure at following blog post:
http://blogs.msdn.com/b/brian_swan/archive/2010/02/12/getting-started-with-php-and-sql-azure.aspx
我将 此 dll 添加到 ext/ 文件夹,然后添加
Extension=php_sqlsrv.dll
到 php7/ 文件夹中的 php.ini。I added this dll to the ext/ folder then added
extension=php_sqlsrv.dll
to the php.ini in the php7/ folder.