Problems related to php connection to mssql Warning: mssql_connect () [function. mssql-connect]

Source: Internet
Author: User
The problem of connecting php to mssql Warning: mssql_connect () [function. mssql-connect]: I have configured PHP5 & nbsp under IIS, but there is always a prompt that Mssql cannot be connected. & Nbsp; my test procedure is as follows: & nbsp; & lt ;? Php & nbsp; $ conmssql_connect (& quot; localhost php connection mssql problem Warning: mssql_connect () [function. mssql-connect]:
I have configured PHP5 under IIS
However, there is always a prompt that Mssql cannot be connected.
My test procedure is as follows:

$ Con = mssql_connect ("localhost", "sa", "123456") or die ('error ');

?>

Error message
Warning: mssql_connect () [function. mssql-connect]: Unable to connect to server: $ sa in D: \ php \ 2.php on line 11
Error

Why! I have used all the online methods! Php is also configured, the semicolon is removed, and the two files are also placed under system32!
Urgent! Thank you!

------ Solution --------------------
"Sa", "123456"

Try to remove spaces. no, print out the error code.
------ Solution --------------------
When the connection fails, mssql_get_last_message () should have information.
------ Solution --------------------
Don't understand, but try removing useless spaces. there are spaces behind your sa, and there are spaces behind 123456, and there are also spaces above localhost. if you do, try removing them.
PHP code
$ Con = mssql_connect ("localhost", "sa", "123456") or die ('error ');
------ Solution --------------------
After configuration, run phpinfo (). if MSSQL exists, install the SQL database on your computer and start the SQL manager;
If there is still no connection, I will give you a link of my own mssql php class library for you to use http://download.csdn.net/source/2691449
------ Solution --------------------
Post the solution to this problem.
------ Solution --------------------
The SQL server configuration is incorrect.

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.