今天,我想把以前用PHP开发的一个系统演示一下,当时用的SQL Server2000。现在我的机器是装的SQL 2005,反正如果用2000的话,再装一下SP4就好了。现在2005,死活连不上。找了好多方法。
最后从这个网址:http://www.php.net/function.mssql-connect
里有这样一段话:
最后从这个网址:http://www.php.net/function.mssql-connect
里有这样一段话:
I am running MS SQL Server 2005 Workgroup Edition on Windows 2003 with PHP 5. I could not connect to a MS SQL database using mssql_pconnect(); until I read a post from ashraf (aat) ametry.com on 01-May-2006 01:25. However, my fix was simply to:
1. Replace the ntwdblib.dll with the one from http://webzila.com/dll/1/ntwdblib.zip in my c:\php5 folder.
2. Restart IIS
REASON: The ntwdblib.dll should be version 2000.80.194.0, and not version 2000.2.8.0 that PHP 5 ships with.
Thank you ashraf for posting your note, however, changing the php.ini file value mssql.secure_connection = On did not work. I left it mssql.secure_connection = Off and that worked (the default to connect through NT/Windows Authentication)
就是下载一个dll覆盖掉PHP5自带的。如果你不用用户名密码的话mssql.secure_connection = Off 设成Off。
总算成功了。
本来在baidu里搜索"PHP5 连接 SQL server 2005",结果就发现在别人有同样的问题,但没有答案。
后来用google搜索“PHP5 connect SQL Server 2005”,一下就找到答案。
说明了什么呢,英语的重要,google搜索英文资料的确方便。