安装/配置
在线手册:中文 英文
PHP手册

运行时配置

这些函数的行为受 php.ini 中的设置影响。

MS SQL Server configuration options
名字 默认 可修改范围 更新日志
mssql.allow_persistent "1" PHP_INI_SYSTEM  
mssql.max_persistent "-1" PHP_INI_SYSTEM  
mssql.max_links "-1" PHP_INI_SYSTEM  
mssql.min_error_severity "10" PHP_INI_ALL  
mssql.min_message_severity "10" PHP_INI_ALL  
mssql.compatability_mode "0" PHP_INI_ALL  
mssql.connect_timeout "5" PHP_INI_ALL  
mssql.timeout "60" PHP_INI_ALL Available since PHP 4.1.0.
mssql.textsize "-1" PHP_INI_ALL  
mssql.textlimit "-1" PHP_INI_ALL  
mssql.batchsize "0" PHP_INI_ALL Available since PHP 4.0.4.
mssql.datetimeconvert "1" PHP_INI_ALL Available since PHP 4.2.0.
mssql.secure_connection "0" PHP_INI_SYSTEM Available since PHP 4.3.0.
mssql.max_procs "-1" PHP_INI_ALL Available since PHP 4.3.0.
mssql.charset "" PHP_INI_ALL Available since PHP 5.1.2 when built with FreeTDS 7.0 or greater.
有关 PHP_INI_* 样式的更多详情与定义,见 Where a configuration setting may be set


安装/配置
在线手册:中文 英文
PHP手册
PHP手册 - N: 运行时配置

用户评论:

pigochu at gmail dot com (19-Feb-2012 04:59)

If mssql.charset = "UTF-8" can't get UTF-8 string , u can use putenv() to set FREETDSCONF dynamic.

see the example
http://www.pigo.idv.tw/archives/1336

Brendon Crawford (23-Apr-2010 12:00)

Use this to check the runtime tds version...

<?php
/**
 *
 * Checks runtime tds version for freetds with mssql
 *
 * @author Brendon Crawford
 * @see http://us.php.net/manual/en/mssql.configuration.php
 * @param string $dbHost
 * @param int $dbPort
 * @param string $dbUser
 * @param string $dbPass
 * @return float
 *
 */
function checkTdsVersion($dbHost, $dbPort, $dbUser, $dbPass) {
   
$cmd = sprintf(
       
'echo "version" | ' .
       
"   tsql " .
       
"       -H '%s' " .
       
"       -p '%s' " .
       
"       -U '%s' " .
       
"       -P '%s' " .
       
"       -o q | " .
       
"cut -d ' ' -f4 ",
       
escapeshellarg($dbHost),
       
escapeshellarg($dbPort),
       
escapeshellarg($dbUser),
       
escapeshellarg($dbPass)
    );
   
$ver = (float)shell_exec($cmd);
    return
$ver;
}
?>

jakub dot otrzasek at marol dot com dot pl (10-Jul-2009 01:03)

mssql.charset      ""      PHP_INI_ALL
this setting is case sensitive, it can provide problms with connection to DB.

 ini_set('mssql.charset', 'utf-8');
this setting this allowed me to connect.

 ini_set('mssql.charset', 'UTF-8');
that one is ok.

regards!

ed at x-space dot net (31-Jan-2009 03:13)

Take care about mssql.max_procs = '-1'. It doesn't mean unlimited procs.

With the default driver, it's mean 25 procs.

See php.ini for more information.

If you're application is stress, mssql_connect may failed without adjustment.

valli at icsurselva dot ch (04-Sep-2008 11:28)

There also exists a configuration option called 'mssql.charset'.
It will override the 'client charset' setting in freetds.conf.
AFAIK this will only take effect if the 'tds version' setting
in freetds.conf is >=7.0