I spent some time searching for possible solutions and finaly found a work arround, that provides correct display of latin and asian fonts from a NVARCHAR field. Overwrite C:\wamp\bin\apache\apache2.2.6\bin\ntwdblib.dll3. Here is the changes required to connect MSSQL database using mssql_connect with long password (more than 30 chars)Steps to follow: 1) cd /usr/local/src/freetds-0.91/2) Change the values as required in freetds src:# Default values:# Filename: include/sybdb.h (line 67)#define DBMAXNAME 30# Filename: include/tds.h (line 760)#define TDS_MAX_DYNID_LEN 30# Filename: include/tds.h (line 831)#define TDS_MAX_LOGIN_STR_SZ 303) Modify the TDS_MAX_LOGIN_STR_SZ macro to overcome the password limitation of 30 chars4) Recompile the freetdsmake clean && ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-gnu-ld && make && make install5) Restart the apache/usr/local/apache2/bin/apachectl stop && /usr/local/apache2/bin/apachectl start6) Export the FREETDSexport FREETDSCONF=/etc/Test the MSSQLdatabase connection using CLI PHP and SQL Server Install And Configure Free TDSThe first thing you need to do is to download and install the Free TDS driver.
Do a SQL query, while you convert the NVARCHAR data first to VARBINARY and then to VARCHAR SELECT CONVERT(VARCHAR(MAX), CONVERT(VARBINARY(MAX),nvarchar_col)) AS x FROM dbo.table While you fetch the result set in PHP, use the iconv() function to convert the data to unicode Running on the following settings I couldn't connect to my local SQL server.- Apache 2.2.6- PHP 5.2.5- SQL Server 2005- Windows XP SP2The problem lies within the wrong dynamic library that is included in Apache and PHP. You can get the source and compile it yourself from but I prefer RPMs.
I worked on a project with a MS SQL server 2008 containing data of NVARCHAR type in multiple languages, including asian characters.
It is a known issue, that the PHP MSSQL functions are not able to retrieve unicode data form NVARCHAR or NTEXT data fields. Start the SQL Server Configuration Manager - Properties tab "IP addresses"7. Restart SQL Server AND Apache, PHP and all the other services Try the following mssql_connect:mssql_connect('localhost,1433', USERNAME, PASSWORD); Good luck!
I installed freetds-0.62.3-1 from installing Free TDS, you can check your driver by attempting to connect to the MSSQL Server.
I hope this will save you some time searching for the solution, if you encounter the same problem.
I'm using SQL 2005 Express Edition on Windows Vista Enterprise with Apache.