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.