Later, it became popular. I installed WIN2003 on a virtual machine and tried it. There was no problem loading the MSSQL module, but I couldn't connect to the database using mssql_connect("localhost", "sa", "");. Later, I searched a lot online. Information, I finally got it:
Environment: IIS6.0+PHP5+SQL Server2005
When installing SQL Server, select the mixed login mode, that is, windows and sql server authentication mode.
Steps:
1. First configure PHP5 to connect to MS SQL Server as usual
Open the extension=php_mssql.dll option in PHP.ini (remove the previous; sign)
2. Download the correct version of ntwdblib.dll (2000.80 .194.0)
3. Overwrite c:windowssystem32ntwdblib.dll
4. Overwrite phpntwdblib.dll (sometimes if this step is not successful, put the php5ts.dll that PHP depends on in the system32 directory)
5. Run SQL Server Configuration Manager: SQL Server Configuration Manager, open Protocols
6. Allow named pipes "named pipes" and "tcp/ip"
7. Right-click "tcp/ip" and open the Properties tab "IP addresses"
8. Fill in 1433 in the TCP dynamic port "TCP Dynamic Ports" (after testing, you can actually leave it blank here)
9. Restart SQL Server, IIS and PHP
10. Use host name + port number to connect, mssql_connect( "localhost,1433", "sa", ""); (I tried it, it works without it)
Some people on the Internet said that we should change mssql.secure_connection = Off in the php.ini configuration file to on, but I After making the change, I couldn't connect to SQL Server after trying for a long time. Then I tried changing mssql.secure_connection = Off back to Off, and finally I was able to connect.
The above introduces the solution to the problem of sqlserver2005 PHP connecting to SQLServer2005, including the content of sqlserver2005. I hope it will be helpful to friends who are interested in PHP tutorials.