Title: DB Connection Errors: Apache Max Childre, or PHP Max Memory
Last modified: June 15, 2021

---

# DB Connection Errors: Apache Max Childre, or PHP Max Memory

 *  [Steven Cooper](https://wordpress.org/support/users/kingcooper/)
 * (@kingcooper)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/db-connection-errors-apache-max-childre-or-php-max-memory/)
 * Hi champs
    I intermittently get Error connecting to database errors on the site
   frontend. Although connecting the wp-admin isn’t a problem really. I have increases
   Apache PHP Max memory, phpini max memory, Apache Max children. My max children
   is running at about 42 for [https://dog-bed.com.au](https://dog-bed.com.au), 
   or 2.8 Mb RAM per request, and 8 for [https://pooch-care.com](https://pooch-care.com)
   or 2.8 Mb RAM per request. But, im still have Error connecting to database intermittently.
   I am stumped to what is wrong with my setup. Do i keep playing with Max children
   setting? As a start, how much memory would a usual WP setup require per child?
   I have about 20 plugins installed across the two domains. Am i on the right path
   recalculating max children settings? Or could it be something else im missing?
   Please can someone chime in on this? Eventually my partners patience will wear
   thin, and our DB Error will cause what is potentially money in the bank to fade
   away in to a failed business practice. Cheers all and god bless Coops
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdb-connection-errors-apache-max-childre-or-php-max-memory%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Website Rob](https://wordpress.org/support/users/website-rob/)
 * (@website-rob)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/db-connection-errors-apache-max-childre-or-php-max-memory/#post-14556984)
 * At the moment no one give a decent reply because more detailed information is
   needed. Your post did not include looking at any error logs and that is where
   you will find what specific problems are occurring. Once that is known, suggestions
   can be made on what to do.
 *  Thread Starter [Steven Cooper](https://wordpress.org/support/users/kingcooper/)
 * (@kingcooper)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/db-connection-errors-apache-max-childre-or-php-max-memory/#post-14558184)
 * Hi Champs
    Sorry i didn’t look at errors because i haven’t really had many to
   take note of. Ive really been going blind on this a bit. I have cPanel.net helping,
   but they don’t have any system problems. I have some mysql error logs too, ill
   just put them in the next post. Here’s the latest of them. Although the error
   connecting to the database was daily for the last how many days. Many.
 *     ```
       [10-Jun-2021 08:40:45 UTC] PHP Warning:  Error while sending QUERY packet. PID=22396 in /home/cooper_p489f3894/public_html/wp-includes/wp-db.php on line 2056
       [10-Jun-2021 09:32:25 UTC] PHP Warning:  Error while sending QUERY packet. PID=32658 in /home/cooper_p489f3894/public_html/wp-includes/wp-db.php on line 2056
       [10-Jun-2021 09:32:25 UTC] PHP Warning:  Error while sending QUERY packet. PID=32652 in /home/cooper_p489f3894/public_html/wp-includes/wp-db.php on line 2056
       [10-Jun-2021 09:32:25 UTC] PHP Warning:  Error while sending QUERY packet. PID=32655 in /home/cooper_p489f3894/public_html/wp-includes/wp-db.php on line 2056
       [10-Jun-2021 09:32:25 UTC] PHP Warning:  Error while sending QUERY packet. PID=32649 in /home/cooper_p489f3894/public_html/wp-includes/wp-db.php on line 2056
       [10-Jun-2021 22:32:50 UTC] PHP Warning:  Error while sending QUERY packet. PID=2280 in /home/cooper_p489f3894/public_html/wp-includes/wp-db.php on line 2056
       ```
   
 *  Thread Starter [Steven Cooper](https://wordpress.org/support/users/kingcooper/)
 * (@kingcooper)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/db-connection-errors-apache-max-childre-or-php-max-memory/#post-14558203)
 * Heres the mysql log:
 *     ```
       [20:45:16 ## root@## ~]cPs# grep -Ei "(out of memory|oom)" /var/log/messages* -A 1 | grep -i mysql
       /var/log/messages:Jun  6 04:08:31 ##kernel: Out of memory: Kill process 16405 (mysqld) score 213 or sacrifice child
       /var/log/messages-Jun  6 04:08:31 ##kernel: Killed process 16405 (mysqld), UID 27, total-vm:1158956kB, anon-rss:400140kB, file-rss:0kB, shmem-rss:0kB
       /var/log/messages:Jun  6 04:08:57 ## kernel: mysqld invoked oom-killer: gfp_mask=0x201da, order=0, oom_score_adj=0
       /var/log/messages-Jun  6 04:08:57 ##kernel: mysqld cpuset=/ mems_allowed=0
       /var/log/messages:Jun  6 04:08:58 ##kernel: Out of memory: Kill process 5369 (mysqld) score 91 or sacrifice child
       /var/log/messages-Jun  6 04:08:58 ##kernel: Killed process 5369 (mysqld), UID 27, total-vm:1101064kB, anon-rss:170464kB, file-rss:0kB, shmem-rss:0kB
       /var/log/messages:Jun  6 04:09:16 ##kernel: mysqld invoked oom-killer: gfp_mask=0x280da, order=0, oom_score_adj=0
       /var/log/messages-Jun  6 04:09:16 ##kernel: mysqld cpuset=/ mems_allowed=0
       /var/log/messages:Jun  6 04:09:28 ##kernel: Out of memory: Kill process 5517 (mysqld) score 89 or sacrifice child
       /var/log/messages-Jun  6 04:09:28 ##kernel: Killed process 5517 (mysqld), UID 27, total-vm:1101072kB, anon-rss:167940kB, file-rss:0kB, shmem-rss:0kB
       /var/log/messages:Jun  6 22:25:21 ##kernel: Out of memory: Kill process 5639 (mysqld) score 282 or sacrifice child
       /var/log/messages-Jun  6 22:25:21 ##kernel: Killed process 5639 (mysqld), UID 27, total-vm:1164796kB, anon-rss:529624kB, file-rss:0kB, shmem-rss:0kB
       /var/log/messages-20210606:Jun  5 00:30:37 ##kernel: Out of memory: Kill process 1666 (mysqld) score 300 or sacrifice child
       /var/log/messages-20210606-Jun  5 00:30:37 ##kernel: Killed process 1666 (mysqld), UID 27, total-vm:1170780kB, anon-rss:562804kB, file-rss:0kB, shmem-rss:0kB
       /var/log/messages-20210606:Jun  5 05:47:17 ##kernel: Out of memory: Kill process 25751 (mysqld) score 253 or sacrifice child
       /var/log/messages-20210606-Jun  5 05:47:17 ##kernel: Killed process 25751 (mysqld), UID 27, total-vm:1188524kB, anon-rss:475012kB, file-rss:0kB, shmem-rss:0kB
       ```
   
 *  [Website Rob](https://wordpress.org/support/users/website-rob/)
 * (@website-rob)
 * [4 years, 11 months ago](https://wordpress.org/support/topic/db-connection-errors-apache-max-childre-or-php-max-memory/#post-14560388)
 * Errors you provided are from June 10 and 6. If you have no errors with today’s
   date then problems are intermittent. That could mean problems occur when server
   is temporarily under a heavy load such as Bot attack.
 * Presuming you already have some security directives in your .htaccess and some
   security plugins, two plugins I recommend are:
 * [https://wordpress.org/plugins/blackhole-bad-bots/](https://wordpress.org/plugins/blackhole-bad-bots/)
   
   [https://wordpress.org/plugins/limit-login-attempts-reloaded/](https://wordpress.org/plugins/limit-login-attempts-reloaded/)

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘DB Connection Errors: Apache Max Childre, or PHP Max Memory’ is closed
to new replies.

## Tags

 * [apache](https://wordpress.org/support/topic-tag/apache/)
 * [error connecting to database](https://wordpress.org/support/topic-tag/error-connecting-to-database/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [Website Rob](https://wordpress.org/support/users/website-rob/)
 * Last activity: [4 years, 11 months ago](https://wordpress.org/support/topic/db-connection-errors-apache-max-childre-or-php-max-memory/#post-14560388)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
