[英]PHP to MS-SQL Server
I am attempting to get a site using PHP to connect to my Microsoft SQL Server, below is everything I can think of: 我正在尝试使用PHP连接到我的Microsoft SQL Server的网站,下面是我能想到的一切:
Server : 2012 服务器 :2012
SQL Server : 2012 SQL Server :2012年
PHP : 7.2.6 的PHP :7.2.6
Code : 代码 :
<?php
$serverName = "ServerName";
$connectionInfo = array( "Database"=>"DBname", "UID"=>"user.name", "PWD"=>"K5zUtwDdzyX8T1vmvtEL");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn==true ) {
echo "Connection established.<br />";
}else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
?>
Other : 其他 :
If there is anything I have left out please let me know and I will promptly provide it. 如果有什么遗漏,请告诉我,我会尽快提供。 I have been lost for quite some time, I am open to any suggestions.
我迷路了很长时间,我愿意接受任何建议。
@Magnus Eriksson @马格努斯·埃里克森
Thank You, I enabled the error display using your link which then displayed the error: 谢谢,我使用您的链接启用了错误显示,然后显示了错误:
Fatal error: Call to undefined function sqlsrv_connect()
Which led me to this post: Fatal error: Call to undefined function sqlsrv_connect() so adding the below to my ini file resolved that issue. 这导致我发此帖子: 致命错误:调用未定义函数sqlsrv_connect(),因此将以下内容添加到我的ini文件中可以解决该问题。
extension = php_sqlsrv_72_nts_x64.dll
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.