1

It's strange problem, I apologize for I really can't explain what kind of problem it is.

I can just say what it happen.

I have a php file, it print the html page, I can't copy whole of my code, it's too long, So I just typo a simple version

<html> // ... some code $count = 0; $query = $mysql->query($sql); while($row = $mysql->fetch_array($query)) { // ... some php code echo "<div id='id{$count}'>.....lots of html code and some php variable </div>" // it is a long html code echo "<ul id='ul{$count}'> ..... almost the same as above, lost html </ul>" echo ... echo ... // ... some php code $count++; } // ... lots of other code </html> 

Normally, It's not any problem, but this time, it will read about 800 record in the loop, then, it can only load about 80.

I think maybe some error occur, so I try to print something in the loop, then something strange happened.

I add this
var_dump("!@#!@#!@#!@#");
Then, I refresh page, now it can load 96 record (I refresh page serval times, always 96)

Then I change it to var_dump("!@#!@#!@#!@#$$$$$");
Now it can load 257 record

after that, I try to change the string that I print, very times I change it, the number of record will change, until I use this:var_dump("!@#!@#!@#!@#!@#!@#!@#!@#", $count);. whole page could be loaded.

11
  • 1
    SO have you looked at your PHP Error log? Your MySQL Error log? or your APache errror log??? Commented Feb 18, 2020 at 9:45
  • Are you using the mysql_ or the mysqli_ or the PDO database extension?? Commented Feb 18, 2020 at 9:46
  • I would start splitting the logic from the view rendering. This will help you to understand where is the error; in the logic calculation or during the rendering. After that, it would be a matter of debugging and checking the error logs. Commented Feb 18, 2020 at 9:47
  • To quote the Floyd, "Is there anybody out there?" Commented Feb 18, 2020 at 9:54
  • @RiggsFolly this project is base on php5.6 and mysql_. Commented Feb 18, 2020 at 10:10

1 Answer 1

4

Some debugging tips:

ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); 

It totally seems that you are reaching some size limits, and script execution (or data handling) stops at one point, which is reached at 69 - or outputting more chars per record - at 257 records.

Maybe

I don't think it's about the number of queries or such, but the the mass of output you generate. Otherwise it would not make any difference how big your var_dump dummy is.

Sign up to request clarification or add additional context in comments.

2 Comments

great! there is is a limit set for PHPs output buffering which causes problems. this tip help me, I don't know where I can modify the config of fastcgi, but I found another answer here stackoverflow.com/q/12165810/8654320, I add the header at the top of my php code, it works
yep, you can edit your answer with the link I found, I will mark this answer

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.