跳至内容

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

已提问 2 个月前122 查看次数

4 回答
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

专家

已回答 2 个月前

专家

已审核 2 个月前

0
已接受的回答

UPDATE:

A week ago, I ran ran/installed this:

 sudo apt install php8.2-fpm php8.2-cli php8.2-common php8.2-mysql php8.2-zip php8.2-gd php8.2-mbstring php8.2-curl php8.2-xml

Then this:

 sudo a2enmod proxy_fcgi setenvif

 sudo a2enconf php8.2-fpm

 sudo systemctl restart apache2

And haven't had a problem since.

已回答 1 个月前

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.

已回答 2 个月前

专家

已审核 2 个月前

0

I'm having the same issue on multiple sites - It's happening even on a landing page with a background and a form. I moved back to the bitnami instance and I'm having ZERO issues. Until this gets fixed I'll stick to it.

已回答 1 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。