English 中文(简体)
Linux php 连接到服务器2008, 运行 MS SQL 服务器快递
原标题:linux php connect to Server 2008 running MS SQL Server Express

i 可以从客户端 PC 连接到 SQL 服务器 Express, 使用以下信服 。 以 mint sudio 表示 :

server: 192.168.44.96sqldb
auth: windows auth
user name: domainuser
pw: 1234!

有一个 LAMP 服务器试图连接到上述 SQL 服务器, 这里显示 PHP 看起来像 :

$server =  192.168.44.96sqldb ;
$username =  domainuser ;
$password =  1234! ;
$database =  testing123 ;
$connection = mssql_connect($server, $username, $password);
if($connection != FALSE){
    echo "Connected to the database server OK<br />";
}
else {
    die("Couldn t connect" . mssql_get_last_message());
}

if(mssql_select_db($database, $connection)){
    echo "Selected $database ok<br />";
}
    else {
    die( Failed to select DB );
}

页面显示无法连接, 错误为. log 表示“ 无法连接 ot 服务器: 192. 168.44. 96 ” 。

我还设置了 msql. security_ connection = 在php.ini 中设置了 msql. security_ connection = 并重新启动了 apache2 。

有什么想法吗?

谢谢!

最佳回答

I can t comment on the PHP part, I only know SQL Server.
But I can tell you: That s not how Windows authentication works.
You can t use Windows authentication and then pass user name and password explicitly to the server. You need to do one of these:

  1. Use SQL Server authentication and pass user name and password explicitly
  2. Use Windows authentication and do not pass user name and password - you will connect automatically with the active Windows user.

既然您正在使用 Linux 服务器, 我非常确定您可以使用 Windows 认证 。 所以您必须使用 SQL 认证( 需要在一个新建的 SQL 服务器安装上启用), 您必须在 SQL 服务器上创建一个用户 。

问题回答

If you have a default sqlexpress installation you probably need to configure your sql server to allow remote access connections. Also I don t know if you can connect with windows auth. At your sql server you can also setup sql authentication and use uid=;pwd=.





相关问题
Export tables from SQL Server to be imported to Oracle 10g

I m trying to export some tables from SQL Server 2005 and then create those tables and populate them in Oracle. I have about 10 tables, varying from 4 columns up to 25. I m not using any constraints/...

SQL server: Can NT accounts be mapped to SQL server accounts

In our database we have an SQL server account that has the correct roles to access some of the databases. We are now switching to windows authentication and I was wondering if we can create a NT user ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签