Reading MSSQL BLOG column data with PHP
I was working on a migration script to transfer data from legacy desktop software to Portal we have developed. While migrating attachments (stored as TIFF files) in BLOB (Binary Large Object) in Microsoft SQL Database Server using PHP it was not a cake-walk. When I observed every time it was creating a file of same size (4KB). I quickly understood that there is some limitation (of size) for reading records in PHP configuration.
I searched through PHP.INI file and found following settings:
; Valid range 0 - 2147483647. Default = 4096. ;mssql.textlimit = 4096 ; Valid range 0 - 2147483647. Default = 4096. ;mssql.textsize = 4096
I removed ";" and made values as zero, thinking that it will let PHP read unlimited size of data but didn't work out. So changed it to max value specified as following and worked perfect:
; Valid range 0 - 2147483647. Default = 4096. mssql.textlimit = 2147483647 ; Valid range 0 - 2147483647. Default = 4096. mssql.textsize = 2147483647
I was able to restore 4000+ BLOB records, creating 10GB of data on file-system with every file being migrated perfectly.
Did this post help you? or did you encountered similar problem? Please share your experience with us. As sharing is the karma of open-source developers like us.!