The problem of truncating text from SQL Server in PHP

PHP and SQL Server are a powerful combination, however sometimes data stored in a text type column is truncated for no apparent reason after 4096 characters.

I got this problem today when I want to display text data from SQL Server 2000. Apparently, I need to increase the maximum size of a text column to be returned from SQL Server by PHP. Since I have control over the Web Server. Here is how I fixed the problem.

Search php.ini and find the lines
;mssql.textlimit = 4096
and
;mssql.textsize = 4096

Replace the value to 2147483647 like this:
mssql.textlimit = 2147483647
mssql.textsize = 2147483647

Also you can do the following just after making a connection.

mssql_query("SET TEXTSIZE 2147483647");

1 thought on “The problem of truncating text from SQL Server in PHP”

  1. Shopping, a nice dinner and bath with candles can set a relaxing mood for any woman. Variations in bed –
    Variations in sexual positions is extremely important if you want to last longer in bed.

    My target audience is not the kind of women who believe
    in the apparently ecstatic response that women in porn have to intercourse.

Leave a Comment