Incomplete php webpage output information

Source: Internet
Author: User
Php webpage output information is incomplete. My php receives data from the server through socket. I think the length is equal to the number of bytes transmitted from the server, but the output is incomplete, I have output through htmlentities. Is there a limit on the number of webpage bytes? Each time a query is submitted, the returned result is always less and less than a certain amount. for example, if the first request contains more than 1000 bytes, the next request may contain less than 2000 bytes. how can this problem be solved?

In the php + apache environment, the test is normal. in the xampp. linux environment, nginx + php-fpm cannot be used, and the output is incomplete. Is there any problem with the configuration?


Reply to discussion (solution)

Can someone tell you what the problem is?

I don't know what you are doing or how you do it.
How can people answer this brainless question?

A php webpage is sent to the php code through the form and post of the HTML webpage, and a request information is sent to the server through socket. after receiving the information, the server generates a pile of data, binary, and then sent to the php end. The php end receives the data. after receiving the data, php calls strlen to test the length of the message body, the length of the package sent by the server is the same, and then displayed on the webpage. in this process, I tested it when the webserver is apche, yes, I use xampp. in the environment of nginx + php-fpm, the output information is incomplete after receiving the message. the same code does not know what the situation is...

I didn't understand what was going on.
However, it is impossible to limit the size of the form value to the web page. if you try not to use htmlentities output, output the result in each step to check the source code. if special characters are parsed.
I have encountered a problem about the differences between Windows and linux characters when processing json, but that is, the first few characters can be truncated.

Echo htmlentities ($ data [$ I], ENT_NOQUOTES, "UTF-8 ")."
"; I use this output to output a part each time, and sometimes it is less... I don't know what is going on. I have parsed the four bytes of integer data at the beginning, followed by binary strings, which are xml data sets including Chinese characters. the key is that I cannot find the cause. I used xampp to test all the tasks normally locally, but an error occurred only when I put it on a linux server... no clue

After receiving data, php calls strlen to test the length of the message body, which is the same as the length of the packet sent by the server.
Are you sure the two server environments have the same length?
The problem lies in the display.

Yes. 3. the server is like this, the configuration problem or something. it's hard to solve it now. I wonder if you 've ever encountered it ..

If the data is not very long, you can paste the base64 encoding of the data to analyze the cause.

I tested the data fragments that I just captured and showed them all... what should I do? thanks.

This is an XML string, although all
However, the Chinese character is GBK encoded (at least you give this part)
Check the output processing code.

I handled it:
$ Recv_res = iconv ("gbk", "UTF-8", $ recv_res );

Then echo htmlentities ($ data [$ I], ENT_NOQUOTES, "UTF-8 ")."
";
I suspect that the output of the number of bytes is limited .....

Can you help me think about it? Thanks, I haven't solved it yet...

Who can advise?

In this case, $ recv_res = iconv ("gbk", "UTF-8", $ recv_res); is that true?
What if one of its members is UTF-8? Isn't it a mess?

Post Code

However, in the apache + php + mysql environment, it is normal .. can be output, and I can reduce the amount of data and complete the output .. I don't think it is a problem of character encoding. when writing source data, we have already specified the character encoding as gbk. This should also be the case if we receive it.

Does anyone know why?

Can someone tell me the reason? thank you.

If you are using Nginx, you can check whether the reverse proxy is enabled by Nginx. as a result, the tmp directory cache of the reverse proxy has no permission or the cache is too small.

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.