Home Backend Development PHP Tutorial php链接局域网mssql的有关问题[原因: 未与信任 SQL Server 连接相关联]

php链接局域网mssql的有关问题[原因: 未与信任 SQL Server 连接相关联]

Jun 13, 2016 pm 01:19 PM
hostname mssql php quot server

php链接局域网mssql的问题[原因: 未与信任 SQL Server 连接相关联]
代码

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
 $hostname="HTSC";
  $dbuser="sa";    
  $dbpasswd="123456";  
  $id = mssql_connect($hostname,$dbuser,$dbpasswd) or die("无法连接数据库服务器!");

Copy after login

如果是本地的mssql数据库,则链接通过。但,如果链接局域网内另外一台机器就不行了。错误信息为:
Warning: mssql_connect() [function.mssql-connect]: message: 用户 '(null)' 登录失败。原因: 未与信任 SQL Server 连接相关联。 (severity 14)

我试了很多办法都不行:
1、SQL Server 和Windows 用混合模式
2、除了sa以外,也试过添加其它用户(具备所有权限)进行链接
3、telnet ip 1433 测试通过
4、数据库都是sql2000 sp4的
5、试过换了几台电脑
6、用sql2000的ntwdblib.dll覆盖了php5的文件

另外,我用vb编写的代码是能正常访问另外一台mssql服务器的。
查看了一下,mssql的用户中,有一个aspnet的用户,是否要添加一个类似的php用户才能登陆呢?

请各位帮帮忙

------解决方案--------------------
$hostname换成IP地址试试
------解决方案--------------------
楼主是用 PHP 连接 SQL SERVER?

需要配置php.ini的,将 ;extension=php_mssql.dll前面的分别去掉

默认不加载任何扩展库的
------解决方案--------------------
探讨
引用:
楼主是用 PHP 连接 SQL SERVER?

需要配置php.ini的,将 ;extension=php_mssql.dll前面的分别去掉

默认不加载任何扩展库的

谢谢你的回答
如果我没有加这个配置的话,php链接本地mssql是测试不通过的。
我现在的情况是:php能链接本地的mssql,但链接不了局域网内其它电脑的mssql

------解决方案--------------------
引用楼主 javaxi 的帖子:
查看了一下,mssql的用户中,有一个aspnet的用户,是否要添加一个类似的php用户才能登陆呢?

------解决方案--------------------
好像之前我也遇到过这种问题。

你直接用sqlserver的图形画界面中 能否通过本机访问其他的电脑呢
------解决方案--------------------
是不是防火墙的问题?
------解决方案--------------------
再次帮顶一下.
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

See all articles