Skip to content

mlouguid/php-ansible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Ansible Role

Ansible role for installing and configuring PHP 8.2 and 8.3 with easy tuning options.

Features

  • Install PHP 8.2 or 8.3
  • Configure PHP settings
  • Manage PHP extensions
  • Simple performance tuning

Requirements

  • Ansible 2.9+
  • Supported OS: Ubuntu, Debian, CentOS

Usage

- hosts: servers
    roles:
        - php82
        - php83

Tuning PHP-FPM

To optimize PHP performance under load, consider the following tuning options for PHP-FPM:

Configuration Settings

  • pm: Set the process manager to either static, dynamic, or ondemand based 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.

Example Configuration

; /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

Additional Tips

  • Monitor your PHP-FPM performance using tools like htop or top.
  • Adjust settings based on traffic patterns and server capabilities.
  • Regularly review logs for errors and performance bottlenecks.

Medium blog

tuning-php

About

php for ansible provisioning tool

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages