Skip to content

lightsail wordpress instance (non-Bitnami) crashing daily - looking for php-fpm www.conf file

0

I have 2 Lightsail Wordpress instances that I recently moved from Bitnami instances to native Lightsail (Debian 12 - bookworm) instances. Both Lightsail configurations are: 1 GB RAM, 2 vCPUs, 40 GB SSD. I've created and enabled 2 GB swapfiles in each instance. Both ran great on Bitnami instances, but are crashing daily on the native Lightsail instances. I've read that the "pm.max_children" setting in www.conf which is "The maximum number of child processes that can be created. This is the most critical setting for preventing memory exhaustion" may be problem and would like to try and reduce this setting. Having said that, I can't seem to locate this file under etc/php/8.2/...

Any help regarding changing this setting or other's experience with moving Wordpress from Bitnami instances to native Lightsail instances would be appreciated.

Some Metrics: Enter image description here

Enter image description here

asked 5 days ago22 views
2 Answers
1

Hello.

I was able to find www.conf after installing Lightsail on my AWS account and then installing php-fpm8.2.

root@ip-172-26-3-107:~# find /etc/php -name "www.conf"
/etc/php/8.2/fpm/pool.d/www.conf

Can you check the system logs and application error logs for the time period when the application crashed?
If you're getting Out of Memory errors, it's likely due to insufficient memory, so adjusting the "max_children" value would be a reasonable solution.
While not limited to WordPress, I've attached a website that may be helpful for tuning php-fpm.
https://chrismoore.ca/2018/10/finding-the-correct-pm-max-children-settings-for-php-fpm/
https://serverfault.com/questions/939436/understand-correctly-pm-max-children-tuning

EXPERT
answered 4 days ago
EXPERT
reviewed 4 days ago
0

I understand you're experiencing daily crashes with your WordPress instances after migrating from Bitnami to native Lightsail Debian 12 instances, and you're looking for the php-fpm www.conf file to adjust the pm.max_children setting.

For Debian 12 (bookworm) with PHP 8.2, the php-fpm pool configuration file is typically located at:

/etc/php/8.2/fpm/pool.d/www.conf

If you can't find it there, you can also check:

  • /etc/php/8.2/fpm/php-fpm.d/www.conf
  • Or run: find /etc/php -name "www.conf" to locate it

Regarding the pm.max_children setting, you're correct that this is crucial for preventing memory exhaustion. With 1 GB RAM and a 2 GB swapfile, you'll want to be conservative with this setting. Each PHP-FPM child process typically uses 30-50 MB of memory, so with 1 GB RAM, you might want to set pm.max_children to around 10-15 to leave room for other processes.

Key settings to review in www.conf:

  • pm.max_children (total number of child processes)
  • pm.start_servers (number started at boot)
  • pm.min_spare_servers (minimum idle processes)
  • pm.max_spare_servers (maximum idle processes)

After making changes, restart php-fpm: sudo systemctl restart php8.2-fpm

You should also monitor your memory usage with free -h and check PHP-FPM logs at /var/log/php8.2-fpm.log for any errors that might indicate what's causing the crashes.

The difference in stability between Bitnami and native instances could be due to different default PHP-FPM configurations, as Bitnami typically optimizes these settings for their stack.

answered 5 days ago
EXPERT
reviewed 4 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.