My DOTD: MS SQL vs. PHP: 4096 is the (default) limit

SQL ServerSmall 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 mssql.textlimit and mssql.textsize.

Since 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 😉

Did this help you out? Like what you see?
Consider donating.

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!

☕️ Buy me a Coffee ($3)

My inc.functions.php – Part 2 : Creating a post slug

PHP Willow TreeIn the second part of this series (Click for part 1) another tiny, yet handy PHP function is described. Some of you might already have discovered the power of having a "post slug" in an URI. Not only does a post slug give an indication to the user (he can tell by the URI what the post/link is all about), it also improves your ranking within search engines as they mark a word in the URI as being important and relevant.

Continue reading “My inc.functions.php – Part 2 : Creating a post slug”

My inc.functions.php – Part 1 : Fixing those gmail.com e-mail addresses.

PHP Willow TreeAfter seeing Shaun’s Fixing the $_FILES superglobal I found myself browsing around in the inc.functions.php file I’ve been using and maintaining project by project. To my own surprise I noticed that the file itself has grown over time and kind of is stuffed with some darn handy functions! Time to spread them out, starting with this one right here: fixGmail();

Continue reading “My inc.functions.php – Part 1 : Fixing those gmail.com e-mail addresses.”