Home > Article > Backend Development > Detailed explanation of steps to connect SQLServer2005 database with PHP_PHP tutorial
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)
mssql.secure_connection = Off
2. Download the correct version of ntwdblib.dll (2000.80.194.0)
3. Overwrite c:windowssystem32
twdblib.dll
4. Override php
twdblib.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 Ports "TCP Dynamic Ports" (after testing, you can actually leave it blank here)
9. Restart SQL Server, IIS and PHP
10. Use the host name and port number to connect, mssql_connect("localhost,1433", "sa", ""); (I tried it, but it doesn't work