Hope you can help me (PHP connection to MSSQL)-php Tutorial

Source: Internet
Author: User
Tags mssql client mssql server
Q: How can I solve the problem of connecting MSSQL with PHP:
1. install MYSQL in centos 5.9,
2. MSSSQL 2005 + WIN7, with ntwdblib and 2005 installed on WIN7.

Problem:
I use PHP to connect to MSSQL. if the connection is local
$ Res = mssql_connect ('127. 0.0.1 ', 'sa', '123 ');
Var_dump ($ res );
?>
If I use the same configuration from another computer, the firewall will be shut down. The related service is also enabled. it is true that the connection fails.


Reply to discussion (solution)

Is MSSSQL 2005 installed on other computers?
What is the php version?

Does the sa account allow remote access in mssql?

Is MSSSQL 2005 installed on other computers?
RE: No

What is the php version? 5.3

Does the sa account allow remote access in mssql?
RE: Yes

Is MSSSQL 2005 installed on other computers?
RE: No

What is the php version? 5.3

Does the sa account allow remote access in mssql?
RE: Yes
Is your PHP and mssql running on one machine? If not, is mssql extension installed on the machine running php? Is the IP address changed to the IP address of the mssql server?

You can change it to an IP address.
Isn't mssql extension ntwdblib. dll? Or something else?

The server has a php Extension Library for enabling PHP.
Does the client still install any other MSSQL or PHP Extension Library?

I checked that PHP is 5.2.

1. if not on the same machine, servername should be the target machine name or ip address +/instance name
2. php 5.3 has no mssql extension
3. by default, MSSSQL 2005 does not allow remote access.

1. if not on the same machine, servername should be the target machine name or ip address +/instance name
RE: IP address used directly without multiple instances
2. php 5.3 has no mssql extension
RE: Just checked 2.96
3. by default, MSSSQL 2005 does not allow remote access.
Mssql2005 remote enabled, because the remote connection with MSSQL client can be successful

Mssql OS win2003 + R2

Output an error and see what the prompt is.

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.