Ansible role for installing and configuring PHP 8.2 and 8.3 with easy tuning options.
- Install PHP 8.2 or 8.3
- Configure PHP settings
- Manage PHP extensions
- Simple performance tuning
- Ansible 2.9+
- Supported OS: Ubuntu, Debian, CentOS
- hosts: servers
roles:
- php82
- php83To optimize PHP performance under load, consider the following tuning options for PHP-FPM:
- pm: Set the process manager to either
static,dynamic, orondemandbased on your application needs. - pm.max_children: Adjust the maximum number of child processes to handle concurrent requests.
- pm.start_servers: Define the number of child processes created on startup.
- pm.min_spare_servers: Set the minimum number of idle processes to handle sudden spikes in traffic.
- pm.max_spare_servers: Limit the maximum number of idle processes to free up resources.
; /etc/php/8.3/fpm/pool.d/www.conf
pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 10- Monitor your PHP-FPM performance using tools like
htoportop. - Adjust settings based on traffic patterns and server capabilities.
- Regularly review logs for errors and performance bottlenecks.