Question: I am connecting to an mssql db on a Windows Server using the FREETDS driver for Linux via PHP.

The web server running the application in running OPENSuSE, Apache2 with PHP, FreeTDS drivers to connect to the Windows box, which it does fine.

I can execute the stored procedure and view the data that it produces, but the outputted data for each array value seems to stop at 64512 bytes (checked using strlen in PHP) - is this a problem on the PHP side or the MS side? Does anyone know how I can fix it?

Answer: 
Have you checked your config file and increased the text size? See the [FAQ](http://freetds.schemamania.org/faq.html#textdata)

```
1> set textsize 10000
2> go

```

> 
> See also the text size option in freetds.conf
> 
> 
>
Other answers here discuss some fairly arbitrary limits. But the PHP config file itself shows the following; this is from PHP 5.6.10 on my macOS setup:

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

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

```

So it’s pretty clear the default is 4096 and the valid range is 0 to 2147483647. So if data is being truncated on return, just adjust those values as follows to max them out:

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

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

```

And just restart Apache to get the new `php.ini` config in place.