Modifiying PHP FPM settings
This post will cover how to modify the values of PHP FPM settings for Linux PHP 8 App Services.
Overview
If you notice slow performance on your PHP app service and the warning messages similar to the one listed below in your log files you might want to consider modifying these settings.
2023-01-06T16:41:41.955903016Z [06-Jan-2023 16:41:41] WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
For App Service Linux PHP 8 images the below are the PHP-FPM settings that can be modified.
Oryx/configuration.md at main · microsoft/Oryx (github.com)
How To
These configuration options can be added as Application Settings.
Configure apps - Azure App Service
Testing and Validation
When these settings are applied, the app service image will apply the below lines of code to modify these values within the file /opt/startup/startup.sh. This file can be viewed from navigating from the app service’s SSH console.
From the SSH console run the top command, to validate the correct number of FPM process are created according to the settings inputed.
What should the value of these settings be?
This is dependant on the application and the amount of memory allocated to the app service plan. Below are a few open source articles that can help your team make an informed decision.
- Adjusting child processes for PHP-FPM (Nginx) · MYSHELL.CO.UK
- Finding the correct pm.max_children settings for PHP-FPM - Chris Moore
- How to Change the PHP-FPM max_children Setting - ServerPilot
The only thing to be aware of is that increasing this setting might raise the memory usage on the app service plan.
We recommend your team monitor the app service plan memory usage when expirementing with this value.