GET 24/7 LIVE HELP NOW

Announcement

Announcement Module
Collapse
No announcement yet.

mysql stops processing suddenly, no error

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • mysql stops processing suddenly, no error

    I have a PHP script that queries the database for a fairly large number of rows, using mysql_query(), then runs through those rows and stores them in PHP array using mysql_fetch_array() for each row. The script does nothing else during the loop, just data storage in an array. For example, on 15,000 rows, it will loop for about 8000 rows, then all processing stops. The server returns a blank page, no time out warning, nothing, just says "Done" in the status bar at bottom of browser.

    After loading the array, the script uses in the information for further processing ... but of course the script doesn't get to that point.

    However, if I instead use mysql_fetch_array() to get one row, then do some PHP processing on that row, THEN get the next row, etc, instead of immediately storing everything into an array first, then it works.

    What could be causing the termination? Is it calling mysql too fast during the loop? Is there a mysql memory problem? I doubt it's a PHP limitation on array size. It's also not a PHP timeout issue; it quits long before that (I've checked).

    I'm using XAMPP on Windows, by the way; however, I've seen a similar thing on my live linux server when doing large queries, where the server returns a blank "Done" page.

    Thanks for any advice. I have to say this forum is a life-saver.

  • #2
    Hmmm ... no replies. Was my question not clear, I wonder?

    Has anyone else experienced mysql just stopping when using PHP's mysql_fetch_array() on lots of rows?

    Comment


    • #3
      Why do you think it's mysql problem?

      I think it could be:
      1) Time limit - set_time_limit(0) to solve.
      2) Memory limit in php - change memory_limit option in your php.ini.

      Comment


      • #4
        How long does it take for your program to loop through 15K rows?

        You said it doesn't take too long but we need specifics...

        Comment


        • #5
          Thank you very much ... memory_limit was it!

          I did a test using memory_get_usage() and sure enough, the script terminated when the PHP array got too big (reached memory_limit).

          This was on Windows, and php.ini is accessible so I set memory_limit there just fine.

          On my live server, memory_limit is *not* configured. Can't see it in phpinfo() and memory_get_usage() fails. Does PHP have a default memory limit, I wonder?

          Comment

          Working...
          X