I was faced with the task of setting up the system to work with Microsoft SQL Server 2008. The system should support multilingualism, as a result, all string data should be stored in fields like nvarchar and ntext. The problem turned out to be that php_mssql.dll is not able to work with these fields, and to use PDO and
SQL Server Driver for PHP, you would have to rewrite a lot of code.
Solving the problem was not difficult ...
To access SQL Server we will use the
FreeTDS library.
')
1. Download the extension for php and copy the dll to the extension_path folder.
http://download.moodle.org/download.php/dblib/php52/DBLIB_TS.zip (Thread Safe)
http://download.moodle.org/download.php/dblib/php52/DBLIB_NOTS.zip (Non Thread Safe)
2. Disable extension = php_mssql.dll in php.ini
3. Install extension = php_dblib.dll in php.ini
4. Create a file c: \ freetds.conf
[global]
host = xxx.xxx.xxx.xxx (ip of the MSSQL server)
port = 1433
client charset = UTF-8
tds version = 8.0
text size = 20971520
5. Everything. Now all mssql_ * functions should work correctly with these types of fields.
ps To connect to SQLServer Express, you do not need to add / SQLEXPRESS to the host name.