# mysql stops processing suddenly, no error

**URL:** https://forums.percona.com/t/mysql-stops-processing-suddenly-no-error/439
**Category:** Other MySQL® Questions
**Created:** [September 7, 2007, 1:20pm UTC](https://forums.percona.com/t/mysql-stops-processing-suddenly-no-error/439 "2007-09-07T13:20:10Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![bluem](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@bluem](https://forums.percona.com/u/bluem)
#### Post date: [September 7, 2007, 1:20pm UTC](https://forums.percona.com/t/mysql-stops-processing-suddenly-no-error/439/1 "2007-09-07T13:20:10Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![bluem](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@bluem](https://forums.percona.com/u/bluem)
#### Post date: [September 11, 2007, 11:12am UTC](https://forums.percona.com/t/mysql-stops-processing-suddenly-no-error/439/2 "2007-09-11T11:12:42Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![scoundrel](https://avatars.discourse-cdn.com/v4/letter/s/3ec8ea/32.png) [@scoundrel](https://forums.percona.com/u/scoundrel)
#### Post date: [September 11, 2007, 1:54pm UTC](https://forums.percona.com/t/mysql-stops-processing-suddenly-no-error/439/3 "2007-09-11T13:54:04Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![allworknoplay](https://avatars.discourse-cdn.com/v4/letter/a/dbc845/32.png) [@allworknoplay](https://forums.percona.com/u/allworknoplay)
#### Post date: [September 11, 2007, 5:36pm UTC](https://forums.percona.com/t/mysql-stops-processing-suddenly-no-error/439/4 "2007-09-11T17:36:07Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![bluem](https://avatars.discourse-cdn.com/v4/letter/b/f04885/32.png) [@bluem](https://forums.percona.com/u/bluem)
#### Post date: [September 14, 2007, 4:16pm UTC](https://forums.percona.com/t/mysql-stops-processing-suddenly-no-error/439/5 "2007-09-14T16:16:28Z")

</div>

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?
