MSSQL text fields in combination with PHP

By Marientjuh on Tuesday 1 November 2011 14:37
Categories: MSSQL, PHP, Views: 3.197

Recently I stumbled upon a little configuration issue with PHP and Microsoft SQL server.

Due to historical reasons is our product running on Windows Server with IIS and PHP in combination with a Microsoft SQL server. Originally the application was developed in old school ASP. Due to the limitations in the language (for me) and my knowledge of PHP we decided to switch to this situation.

Recently we converted our language files to database entries (with cache language files) to make the management of our languages easier. Everything worked fine until the ‘Legal notice’ text was added to the translations. This is quite a long text and after addition it clipped after an X characters. After a quick peek in the SQL Server Management tool I found out that the text was actually in the database and thus the issue was in retrieving the data from the database.

After some research I found out that the MSSQL extension has some configuration variables in php.ini. The variables which control the clipping behavior are ‘mssql.textlimit’ and ‘mssql.textsize’. By default are these variables commented out but then these values turn to their default value of 4096. And that was exact the limit where our ‘Legal notice’ was clipped on.

Changing the values to its maximum value in php.ini fixed our problem.

; Valid range 0 - 2147483647.  Default = 4096.
mssql.textlimit = 2147483647

; Valid range 0 - 2147483647.  Default = 4096.
mssql.textsize = 2147483647

Volgende: Helpdesk 11-'11 Helpdesk
Volgende: Je leven ziet er niet goed uit als... 10-'11 Je leven ziet er niet goed uit als...


Comments are closed