PHP版本5.3.5php
操做系統win7html
使用mssql方式連接:sql
$hostname = '192.168.0.178:1435';
$username = 'test';
$password = 'test';apache
mssql_connect($hostname, $username, $password);操作系統
程序報錯:.net
Fatal error: Call to undefined function mssql_connect()htm
使用phpinfo(),顯示沒有mssql信息blog
查看php.ini,已經有:get
extension=php_mssql.dllit
經驗證,和上面的擴展無關,須要另外一擴展:
extension=php_dblib.dll
加入以後重啓apache,顯示:
MSSQL Support | enabled |
---|---|
Active Persistent Links | 0 |
Active Links | 0 |
Library version | FreeTDS |
Directive | Local Value | Master Value |
---|---|---|
mssql.allow_persistent | On | On |
mssql.batchsize | 0 | 0 |
mssql.charset | no value | no value |
mssql.compatability_mode | Off | Off |
mssql.connect_timeout | 5 | 5 |
mssql.datetimeconvert | On | On |
mssql.max_links | Unlimited | Unlimited |
mssql.max_persistent | Unlimited | Unlimited |
mssql.max_procs | Unlimited | Unlimited |
mssql.min_error_severity | 10 | 10 |
mssql.min_message_severity | 10 | 10 |
mssql.secure_connection | On | On |
mssql.textlimit | Server default | Server default |
mssql.textsize | Server default | Server default |
mssql.timeout | 60 | 60 |
此文:http://www.lifangjin.com/archives/949
次下載地址:http://docs.moodle.org/20/en/Installing_MSSQL_for_PHP#Using_FreeTDS_on_Windows
另有此文:
http://blog.csdn.net/q356309936/article/details/7838260
http://www.th7.cn/Program/php/201303/129462.shtml
說明php5.3以上已不是原生支持mssql,也就是說,使用php_dblib.dll來支持mssql,而不是php_mssql.dll
此文轉載至http://blog.csdn.net/qdujunjie/article/details/17381621