Solution to incomplete ntext reading for php + SQL server fields

Source: Internet
Author: User
Tags mssql

Php + mssql makes it really painful. The type of ntext fields used to read mssql in php has another problem: when the content of ntext is too long, the ntext fields are not completely read.

I have been searching for it on the Internet for a long time. It is said that ntext reading in php is incorrect, but I was depressed if I didn't find my page error. Later I found out that php can only read 4 kB of content by default. It turns out that my content exceeds 4 kB. The modification method is as follows:

1. Upgrade php to php5.

Fortunately, I already have php5.

2. Adjust the parameters of php. ini to increase the default value of php to 4 K.

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

; Valid range 0-2147483647. Default = 4096.
; Mssql. textsize = 20480

 
";" Before mssql. textlimit and mssql. textsize, and then change the default value to a larger value, such as 20480 (20 K)

3. Restart the web server.


I thought the exciting time would come. When I run the php page, the effect was still the same as before, and the field data was not completely read. Later, I found out that php is not very friendly with ntext support and should be converted to text. So we use

Convert (text, content) is switched, without any effect, and I almost killed my iis. I have been searching for it online for a long time. When I was about to give up, I tried to change the database connection method. I put

The change of odbc_connect to mssql_connect succeeded.


It seems that mssql in php is better than mssql_connect. However, php is perfect when combined with mysql.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.