In the case of php5.3, The dblib driver of pdo cannot connect to mssql. According to the official description, 5.2 has modified this bug, but 5.3 does not. You can use the mssql function provided by php.
In the case of php5.3, The dblib driver of pdo cannot connect to mssql. According to the official description, 5.2 has modified this bug, but 5.3 does not. You can use the mssql function provided by php.
In the case of php5.3, The dblib driver of pdo cannot connect to mssql. According to the official description, 5.2 has modified this bug, but 5.3 does not.
You can use the mssql function that comes with php. Compile freetds, php_mssql, and pdo_dblib as follows:
./Configure -- prefix =/usr/local/freetds -- with-tdsver = 8.0 -- enable-msdblib
./Configure -- with-php-config =/usr/local/php/bin/php-config -- with-mssql =/usr/local/freetds/
. /Configure -- with-php-config =/usr/local/php/bin/php-config -- with-mssql =/usr/local/freetds -- enable-pdo -- with-pdo -dblib =/usr/local/freetds/
The character set cannot be set with the built-in mssql function, and set names is not supported. Finally, I referred to the adodb code and found that com or ative mssql driver must be used to solve this problem, these two things can be used in windows, but linux is not very good. The solution is to edit/usr/local/freetds/etc/freetds. conf.
Adding a client charset = GBK and setting it to UTF-8 is incorrect, because the mssql sorting rule database is set to Chinese PRC by default, which is equivalent to gb2312,
In addition, mssql. charset in php. ini does not need to be set. In fact, it is clear:
; Specify client character set.
; If empty or not set the client charset from freetds. comf is used
; This is only used when compiled with FreeTDS
This parameter is required only when the FreeTDS client charset is null or is not set. If the character is incorrectly set to UTF-8, And the FreeTDS client charset is also set to utf8, an error is reported when mssql_connect is returned. In the final conclusion, you only need to set the FreeTDS client charset to GBK, and then in the php program iconv ('gbk', 'utf-8 // IGNORE ', $ str ); everything is normal.