Home  |  About  | Last |  Submit  |  Contact
AllQuests.com

Previous Question:  FW 2.80 DownDate to FW 2.71 for TA 079~086 PSP v0.01 By 0okm[  PSP DiscussionNext Question:  Problems with abstract class in mvs2005  Visual C++ Programming

Question PHP Function stops mid loop. ( CodeGuru Forums Scripting Server Side (PHP, Perl, etc.) )
Updated: 2008-08-12 06:10:12 (5)
PHP Function stops mid loop.

I have a PHP script that is supposed to do some processing on about 20Kb of data and echo it to the screen.

The loop just stops at the exact same location every time. No error message or anything. It does not continue to execute any code after the function either.

I know that I am not reaching the 30 sec max execution time (it takes <2 seconds), and that I am not trying to echo too much data to the screen (it stops at about 12 Kb).

Here is a sample piece of code that generates the problem (at lease on my computer)...

Code:
for ($i = 0;$i < 10000000; $i ++) { echo $i . "-"; }


Every time it ends at the same number: "2127".

I've searched the web, but didn't find anything. It's hard to know what to Google when I'm not quite sure what my problem is.


-Scott

Answers: PHP Function stops mid loop. ( CodeGuru Forums Scripting Server Side (PHP, Perl, etc.) )
PHP Function stops mid loop.

Could it be that there's some terminating character in your document (or, the data you are processing) at that position? I thought of this because Teranoz tested your code, and it runs fine on his end (assuming he used a different file).

Also, a counter-test would be to change the increment (for example, increment $i by 2 in every loop iteration), and see where it stops then.



PHP Function stops mid loop.

I checked all of my logs and settings. The page takes under 2 seconds to load and my max_execution_time is set to the standard 30.

Just to be sure I tried it on 2 separate servers - same problem.

The page loads a different amount of data when viewed in a different browser, yet it still doesn't load the whole page.

spark128000

PHP Function stops mid loop.

Also check your error log. It's possible that your have passed your time limit of PHP execution.



PHP Function stops mid loop.

Sorry to double post, but here is some extra information...

The below code stops at the same number and does print it to the browser after the loop.

Code:
$a = ""; for ($i = 0;$i < 5000; $i ++) { $a .= $i . "-"; } echo $a;

spark128000

PHP Function stops mid loop.

Its not your code, it runs ok when I test it.
Maybe check webserver and PHP config

Teranoz

Previous Question:  FW 2.80 DownDate to FW 2.71 for TA 079~086 PSP v0.01 By 0okm[  PS3Forums  PSP DiscussionNext Question:  Problems with abstract class in mvs2005  CodeGuru Forums  Visual C++ Programming

- Source: PHP Function stops mid loop. CodeGuru Forums Scripting Server Side (PHP, Perl, etc.)
- Previous Question: FW 2.80 DownDate to FW 2.71 for TA 079~086 PSP v0.01 By 0okm[ PS3Forums PSP Discussion
- Next Question: Problems with abstract class in mvs2005 CodeGuru Forums Visual C++ Programming





AllQuests.com


Best dedicated servers   Top dedicated servers   Cheap dedicated servers   Linux dedicated servers   Windows dedicated servers   Unmetered dedicated servers