Skip to Content

Problem with Truncated Article Content for SQL Server Edition

Estimated Reading Time: 1 Minutes

This information is applicable on the PHPKB Enterprise Edition with SQL Server Database. There is no such issue in the MySQL version of PHPKB knowledge base software.

PROBLEM: Article content gets trimmed for no apparent reason after 4096 characters. Some of our customers encountered an unusual problem with the SQL Server version of PHPKB software. It was that every time large amount of text was saved in article content, it was truncated at around 4000 characters.

SOLUTION: It is due to the settings for the mssql extension in PHP, resulting in strange behaviour. Here’s how to fix the problem.

You need to increase the maximum size of a text column to be returned from SQL Server by PHP. You can do this with a simple SQL query:

SET TEXTSIZE 2147483647
Which you can run with the following PHP (best run just after you make a connection).

mssql_query("SET TEXTSIZE 2147483647");
A better way to work around the issue is to change the "textlimit" and "textsize" settings within php.ini, like so:

mssql.textlimit = 2147483647
mssql.textsize = 2147483647
In the above examples, we have used "2147483647" (number of bytes) for the value. You don’t need to set it this high necessarily, however there is no real harm in doing so.
  • Applicable To: Enterprise Edition (SQL Server), Enterprise Multi-Language Edition (SQL Server)
Problem with Truncated Article Content for SQL Server Edition