: Mssql_connect () connection problem under CentOS, "Unable to connect to server" issue appears.

Source: Internet
Author: User
Tags mssql server mssqlserver
The "Unable to connect server" error message always appears when using Mssql_connect () under the CentOS system.

Background: The Web server for the CentOS system needs to connect to the MSSQL database server. MSSQL database uses MSSSQL2000, (MSSQL2008 also tried, the problem is the same).

The CentOS system installs the FreeTDS and Php-mssql modules using the Yum Install method, using Phpinfo () to see if the Php-mssql has been successfully installed. Using the TSQL test to connect the MSSQL account password under CentOS is correct. However, when connecting using the Mssql_connect () function in a php file, there is always a "Unable to connect server" Fault prompt (via error_log query).

Program code:
$link = Mssql_connect (' 192.168.100.10:1433 ', ' sa ', ' * * * * '); There are always errors, add no port number: 1433, the fault is still if (! $link)
{
Die (' Unable to connect! error: '. Mssql_get_last_message ());
}
?>


Seek the expert to solve!


Reply to discussion (solution)

Just one can't connect, no more clear error message?
Output mssql_get_last_message () see what it is.
It looks like it's installed properly, right? SQL Server I had a situation where SA was not recorded successfully and the final setting was resolved
You test it again and try to get a more detailed error message.

And you change the IP to localhost or 127.0.0.1 and try again.

You don't have the authority, of course not even up.

Is it the original code? Why do I look at mysql_connect () all wrong????

The project needs to connect to the previous database server, the previous database is MSSQLServer2000, and is now migrating to the Web environment. So we need to use the MSSQL module of PHP.
The Web server rack is the Linux architecture, the database side is another Windows MSSQLServer server, so and with localhost or 127.0.0.1 is definitely not the way. Because the first step of the database is not connected, so Mssql_get_last_message () and feedback back.
should also not be a permission problem, has been used in TSQL query, all queries are normal.
Another, on another computer, use manual decompression to install FreeTDS, PHP, recompile installation, can connect the MSSQL database properly.
My judgment is that when installing FreeTDS and php-mssql in yum mode, it is unclear if there is any missing step. So ask if there is no such an expert.

The database side is another Windows MSSQLSERVER server!!!
Are you cross-domain access, halo
The default installation of MSSQL, which is not allowed for remote linking, requires that the remote link be opened to the server in Configuration Manager before it can be properly linked.
In addition, the remote link, also affected by the firewall, any one end (that is, the client and server side) of the firewall, can prohibit its normal link.
It is recommended to configure the network environment first, and then check the MSSQL configuration, the last is to check your PHP program.

Have already said: TSQL has tested the connection to MSSQL, the query is normal! There is no problem with the parameters, just the use of the Mssql_connect () function is not available. Of course not MSSQL server configuration issues, nor firewall and network environment issues.

Query the/var/log/httpd/error_log log under CentOS, and appear "... Warning:mssql_connect (): Unable to connect to server:192.168.100.10:1433 in ... "

My judgment is that when Yum installs FreeTDS and php-mssql, I don't know what's wrong.

Find out how to use the Yum configuration experience under CentOS!

Solve yourself.
Two methods:
1. Run Command Setenforce 0
2. Open/etc/selinux/config, set SELinux to Disabled, and restart.

I also met a mold one?????? Gangang the solution?? What??? The manager?

Also want to know how to solve, this is I ask the same question, but write more detailed. http://ask.csdn.net/questions/69462

Landlord solved the No
Warning:mssql_connect (): Unable to connect to server:

  • 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.