Small tip: when getting data from a MS SQL Database through PHP you’ll notice that your data gets chopped. First thought that the datatypes of the fields weren’t sufficient enough to hold the data, but the
text datatype can hold up to
2ˆ31 - 1 characters and the data was stored correctly in the database …
After a little investigation I found that the data got chopped at 4096 characters, which is a bit too familiar as it’s the outcome of
2ˆ12. Digging a bit deeper it turns out that the problem lies within
php.ini as it defaults to only returning 4096 characters. The settings controlling these are
4096 is way too little, I’ve changed it to
1048576 (which is
2ˆ20) which should be more than enough.
; Valid range 0 - 2147483647. Default = 4096. mssql.textlimit = 1048576 ; Valid range 0 - 2147483647. Default = 4096. mssql.textsize = 1048576
Hope this saves you some research and hassle 😉
I don’t run ads on my blog nor do I do this for profit. A donation however would always put a smile on my face though. Thanks!