Php connection to local area network mssql [cause: it is not associated with a trusted SQLServer connection]

Source: Internet
Author: User
Tags mssql server
Php connection to Lan mssql [cause: it is not associated with a trusted SQLServer connection] code PHPcode $ hostname = & quot; HTSC & quot; $ dbuser = & quot; sa & quot; $ dbpasswd = & quot; 123456 & quot; $ id = MS php link Lan mssql problem [cause: not associated with trusted SQL Server connection]
Code
PHP code
  $ Hostname = "HTSC"; $ dbuser = "sa"; $ dbpasswd = "123456"; $ id = mssql_connect ($ hostname, $ dbuser, $ dbpasswd) or die ("unable to connect to the database server! ");

If it is a local mssql database, the link passes. However, it won't work if another machine in the Lan is connected. Error message:
Warning: mssql_connect () [function. mssql-connect]: message: User '(null)' login failed. Cause: it is not associated with a trusted SQL Server connection. (Severity 14)

I tried a lot of methods and I couldn't do it:
1. hybrid mode for SQL Server and Windows
2. in addition to sa, you have also tried to add other users (with all permissions) for the link.
3. telnet ip 1433 passed the test
4. databases are all sql2000 sp4
5. I have tried changing some computers.
6. use ntwdblib. dll of sql2000 to overwrite the php5 file

In addition, the code I wrote in vb can normally access another mssql server.
Check that there is an aspnet user in mssql. do you want to add a php user similar to this to log on?

Please help

------ Solution --------------------
Change $ hostname to an IP address.
------ Solution --------------------
Is the main author using PHP to connect to SQL SERVER?

If you need to configure php. ini, remove the ones before extension = php_mssql.dll.

By default, no extended library is loaded.
------ Solution --------------------
Discussion
Reference:
Is the main author using PHP to connect to SQL SERVER?

If you need to configure php. ini, remove the ones before extension = php_mssql.dll.

By default, no extended library is loaded.

Thank you for your answer.
If this configuration is not added, the connection to the local mssql in php fails to be tested.
My current situation is: php can link to the local mssql, but cannot link to the mssql of other computers in the Lan

------ Solution --------------------
Reference the post of javaxi:
Check that there is an aspnet user in mssql. do you want to add a php user similar to this to log on?

------ Solution --------------------
It seems that I have encountered this problem before.

Can you directly use sqlserver's graphic interface to access other computers through the local machine?
------ Solution --------------------
Is it a Firewall problem?
------ Solution --------------------
Try again.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.