php链接sql server报错Fatal error: Call to undefined function mssql_connect()

PHP版本5.3.5

操作系统win7

 

使用mssql方式链接:

$hostname = '192.168.0.178:1435';
$username = 'test';
$password = 'test';

mssql_connect($hostname, $username, $password);

 

程序报错:

 

Fatal error: Call to undefined function mssql_connect()

 

使用phpinfo(),显示没有mssql信息

 

查看php.ini,已经有:

extension=php_mssql.dll

 

经验证,和上面的扩展无关,需要另一扩展:

extension=php_dblib.dll

 

加入之后重启apache,显示:

 

 

mssql

 

 

MSSQL Supportenabled
Active Persistent Links 0
Active Links 0
Library version FreeTDS

 

DirectiveLocal ValueMaster 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

posted @ 2017-06-23 16:59  慕辰峰丶  阅读(519)  评论(0编辑  收藏  举报