Mssql_connect () connection problems in CentOS, "Unabletoconnecttoserver" problems

Source: Internet
Author: User
Help: mssql_connect () connection problem in CentOS, where the & quot; Unabletoconnecttoserver & quot; problem occurs. & Nbsp; "Unable & nbsp; to & nbsp; connect & nbsp help" always appears when mssql_connect () is used in the CentOS system: the mssql_connect () connection problem in CentOS may cause "Unable to connect to server.
When mssql_connect () is used in CentOS, the error message "Unable to connect server" is always displayed.

Background: The web server of centOS needs to connect to the database server of MSSQL. The mssql database uses MSSSQL2000. (MSSQL2008 has also tried, and the problem is the same ).

In centOS, Freetds and php-mssql modules are installed using yum install. use phpinfo () to check whether php-mssql has been installed successfully. Use tsql in centOS to test the connection to the mssql account and password. However, when the mssql_connect () function is used to connect to the PHP file, the error message "Unable to connect server" always appears (query by error_log ).

Program code:
$ Link = mssql_connect ('2017. 168.100.10: 1433 ', 'sa', '*****'); // an error occurs. Add the port number: 1433 without adding it. if (! $ Link)
{
Die ('unable to connect! Error: '. mssql_get_last_message ());
}
?>


Please solve it!
------ Solution --------------------
Is there a clear error message that cannot be connected?
Output mssql_get_last_message () to see what it is.
It seems that the installation is normal. what is the permission? In SQL server, if sa is not recorded successfully, the final setting will be solved.
Try again to get more detailed error information
------ Solution --------------------
You can also change the ip address to localhost or 127.0.0.1 and try again.
------ Solution --------------------
You do not have permission. of course you cannot connect.
------ Solution --------------------
Is it the original code? Why did I get an error in mysql_connect ????
------ Solution --------------------
The database is another windows MSSqlServer server !!!
Are you using cross-origin access?
The default MSSQL installation does not allow remote connection. you need to open the remote connection in the server configuration manager to connect to the server.
In addition, remote connections are also affected by the firewall. normal connections can be disabled at any end (client and server.
We recommend that you first configure the network environment, then check the MSSQL configuration, and finally check your PHP program.

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.