{"id":24863699,"url":"https://github.com/stuvusit/php-fpm","last_synced_at":"2026-05-04T13:32:22.906Z","repository":{"id":24584420,"uuid":"87806999","full_name":"stuvusIT/php-fpm","owner":"stuvusIT","description":"Install and configure PHP-FPM with Ansible","archived":false,"fork":false,"pushed_at":"2023-12-21T21:52:52.000Z","size":83,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-31T23:32:57.777Z","etag":null,"topics":["ansible","ansible-role","debian","fpm","php","php-fpm","ubuntu"],"latest_commit_sha":null,"homepage":"","language":"Jinja","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-sa-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stuvusIT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-10T12:15:36.000Z","updated_at":"2022-03-02T12:32:44.000Z","dependencies_parsed_at":"2022-08-29T19:12:16.004Z","dependency_job_id":null,"html_url":"https://github.com/stuvusIT/php-fpm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuvusIT%2Fphp-fpm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuvusIT%2Fphp-fpm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuvusIT%2Fphp-fpm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stuvusIT%2Fphp-fpm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stuvusIT","download_url":"https://codeload.github.com/stuvusIT/php-fpm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245707897,"owners_count":20659612,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","ansible-role","debian","fpm","php","php-fpm","ubuntu"],"created_at":"2025-01-31T23:33:20.863Z","updated_at":"2026-05-04T13:32:17.886Z","avatar_url":"https://github.com/stuvusIT.png","language":"Jinja","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-fpm\n\nThis is an Ansible role which sets up a php-fpm instance and configures the pools.\n\n\n## Requirements\n\nDebian or Ubuntu\n\n\n## Role Variables\n\n| Name                                  | Required/Default         | Description                                                                                                                                               |\n|:--------------------------------------|:------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `php_fpm_package_name`                | `php-fpm`                | The name of the apt package to install, e.g. `php8.0-fpm` or `php7.3-fpm`.                                                                                |\n| `php_fpm_disable_cron`                | `False`                  | Setting this to `True` removes the cron script to send emails for PHP warnings.                                                                           |\n| `php_fpm_pools`                       | :heavy_check_mark:       | List of php-fpm pools to define, see [pools](#pools).                                                                                                     |\n| `php_fpm_ini_values`                  | `{PHP: {expose_php: 0}}` | Dict of `php.ini` values, see [php.ini](#php.ini).                                                                                                        |\n| `php_fpm_php_version`                 | **auto determined**      | PHP version (used to specify correct include paths).                                                                                                      |\n| `php_fpm_pid`                         | `/run/php-fpm.pid`       | Path to PID file (`/var` is prepended for relative paths)                                                                                                 |\n| `php_fpm_error_log`                   | `log/php-fpm.log`        | Path to PID file (`/var` is prepended for relative paths)                                                                                                 |\n| `php_fpm_log_level`                   | `notice`                 | Log level - possible values are `alert`, `error`, `warning`, `notice`, `debug`.                                                                           |\n| `php_fpm_syslog_facility`             | `daemon`                 | Used to specify what type of program is logging the message.                                                                                              |\n| `php_fpm_syslog_ident`                | `php-fpm`                | Prepended to every log message.                                                                                                                           |\n| `php_fpm_emergency_restart_threshold` | `0`                      | If this number of child processes exit with SIGSEGV or SIGBUS within the time interval set by `php_fpm_emergency_restart_interval` then FPM will restart. |\n| `php_fpm_emergency_restart_interval`  | `0`                      | Interval of time used by emergency restart interval to determine when a graceful restart will be initiated.                                               |\n| `php_fpm_process_control_timeout`     | `0`                      | Time limit for child processes to wait for a reaction on signals from master.                                                                             |\n| `php_fpm_process_max`                 | `0`                      | The maximum number of processes FPM will fork.                                                                                                            |\n| `php_fpm_process_priority`            | :heavy_multiplication_x: | Specify the `nice` priority to apply to the master process                                                                                                |\n| `php_fpm_daemonize`                   | `True`                   | Whether to send FPM to background                                                                                                                         |\n| `php_fpm_rlimit_files`                | `16400`                  | Set open file descriptor rlimit for the master process.                                                                                                   |\n| `php_fpm_rlimit_core`                 | `0`                      | Set max core size rlimit for the master process.                                                                                                          |\n| `php_fpm_events_mechanism`            | :heavy_multiplication_x: | Specify the event mechanism FPM will use. The following is available: `select`, `pool`, `epoll`.                                                          |\n| `php_fpm_systemd_interval`            | `10`                     | Specify the interval (in seconds) between health report notification to systemd.                                                                          |\n\n\n### php.ini\n\n`php_fpm_php_ini_values` is a dict containing the sections as keys.\nEach section is another dict containing the option value as key.\nEach option entry is a list containing the values to be written under that section and option.\nSee the following example:\n\n```\nphp_fpm_php_ini_values:\n  SECTION NAME: # Name from the php.ini file section where the variable is supposed to live.\n    OPTION NAME: # The actual variable name\n      - value1 # The value/values that the option should have (Option values are treated as a list since Ansible can not differentiate between types.)\n      - value2\n```\n\nTo see all vars possible for `php.ini` see the [php.ini page](https://secure.php.net/manual/de/ini.list.php).\n\n\n### Pools\nEach pool is specified by a dict in the `php_fpm_pools` list.\n\n| Name                        | Required/Default                                            | Description                                                                                                                                                            |\n|:----------------------------|:-----------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name`                      | :heavy_check_mark:                                          | Name of the pool                                                                                                                                                       |\n| `listen`                    | :heavy_check_mark:                                          | The address on which to accept FastCGI requests. Valid syntaxes are: 'ip.add.re.ss:port', 'port', '/path/to/unix/socket'.                                              |\n| `user`                      | :heavy_check_mark:                                          | Unix user running the FPM processes.                                                                                                                                   |\n| `group`                     | :heavy_multiplication_x:                                    | Unix group running the FPM processes.                                                                                                                                  |\n| `pm`                        | :heavy_check_mark:                                          | Choose how the process manager will control the number of child processes. Possible values are `static`, `ondemand`, `dynamic`.                                        |\n| `pm_max_children`           | :heavy_multiplication_x: (if `pm` is `static` or `dynamic`) | The number of child processes to be created when pm is set to static and the maximum number of child processes to be created when pm is set to dynamic.                |\n| `listen_backlog`            | `{{ php_fpm_listen_backlog }}` (`-1`)                       | Maximum number of requests in the backlog.                                                                                                                             |\n| `allowed_clients`           | `{{ php_fpm_listen_allowed_clients }}` (`[any]`)            | List client IP addresses allowed to connect.                                                                                                                           |\n| `listen_owner`              | :heavy_multiplication_x:                                    | Owner of the Unix socket, if one is used                                                                                                                               |\n| `listen_group`              | :heavy_multiplication_x:                                    | Group of the Unix socket, if one is used                                                                                                                               |\n| `listen_mode`               | `{{ php_fpm_listen_mode }}` (`0660`)                        | File mode of the Unix socket, if one is used                                                                                                                           |\n| `listen_acl_users`          | :heavy_multiplication_x:                                    | List of ACL user names. If used, `listen_owner` and `listen_group` are ignored.                                                                                        |\n| `listen_acl_groups`         | :heavy_multiplication_x:                                    | List of ACL group names. If used, `listen_owner` and `listen_group` are ignored.                                                                                       |\n| `pm_start_servers`          | :heavy_multiplication_x:                                    | Number of child processes created on startup                                                                                                                           |\n| `pm_min_spare_servers`      | :heavy_multiplication_x:                                    | Minimum number of idle server processes                                                                                                                                |\n| `pm_max_spare_servers`      | :heavy_check_mark: (if `pm` is `dynamic`)                   | Maximum number of idle server processes                                                                                                                                |\n| `process_idle_timeout`      | `{{ php_fpm_pm_process_idle_timeout }}` (`10s`)             | Number of seconds after which an idle process will be killed. Only used when `pm` is `ondemand`                                                                        |\n| `pm_max_requests`           | `{{ php_fpm_pm_max_requests }}` (`0`)                       | The number of requests each child process should execute before respawning.                                                                                            |\n| `pm_status_path`            | :heavy_multiplication_x:                                    | The URI to view the FPM status page.                                                                                                                                   |\n| `ping_path`                 | :heavy_multiplication_x:                                    | The ping URI to call the monitoring page of FPM (must start with `/`).                                                                                                 |\n| `ping_response`             | `{{ php_fpm_ping_response }}` (`pong`)                      | Set the response of a ping request. The response is formatted as text/plain with a 200 response code.                                                                  |\n| `processes_priority`        | :heavy_multiplication_x:                                    | Specify the nice priority to apply to the worker process.                                                                                                              |\n| `prefix`                    | :heavy_multiplication_x:                                    | Specify prefix for path evaluation.                                                                                                                                    |\n| `request_terminate_timeout` | `{{ php_fpm_request_terminate_timeout }}` (`0`)             | The timeout for serving a single request after which the worker process will be killed.                                                                                |\n| `request_slowlog_timeout`   | `{{ php_fpm_request_slowlog_timeout }}` (`0`)               | The timeout for serving a single request after which a PHP backtrace will be dumped to the `slowlog` file.                                                             |\n| `slowlog`                   | `{{ php_fpm_slowlog }}` (`log/php-fpm.log.slow`)            | The log file for slow requests.                                                                                                                                        |\n| `rlimit_files`              | :heavy_multiplication_x:                                    | Set open file descriptor rlimit for child processes in this pool.                                                                                                      |\n| `rlimit_core`               | :heavy_multiplication_x:                                    | Set max core size rlimit for child processes in this pool.                                                                                                             |\n| `chroot`                    | :heavy_multiplication_x:                                    | Chroot to this directory (absolute path) at the start.                                                                                                                 |\n| `chdir`                     | :heavy_multiplication_x:                                    | Chdir to this directory (absolute path) at the start.                                                                                                                  |\n| `catch_workers_output`      | `{{ php_fpm_catch_workers_output }}` (`False`)              | Redirect worker stdout and stderr into main error log.                                                                                                                 |\n| `clear_env`                 | `{{ php_fpm_clear_env }}` (`True`)                          | Clear environment in FPM workers.                                                                                                                                      |\n| `security_limit_extensions` | `php_fpm_security_limit_extensions` (`[.php, .phar]`)       | Limits the extensions of the main script FPM will allow to parse.                                                                                                      |\n| `access_log`                | :heavy_multiplication_x:                                    | The access log file.                                                                                                                                                   |\n| `access_format`             | `{{ php_fpm_access_format }}` (`%R - %u %t \\\"%m %r\\\" %s`)   | The access log format.                                                                                                                                                 |\n| `envs`                      | :heavy_multiplication_x:                                    | Dict of environment variables to set.                                                                                                                                  |\n| `php_flags`                 | :heavy_multiplication_x:                                    | Dict of `php.ini` directives to set for this pool. The value of a directive should be a boolean.                                                                       |\n| `php_admin_flags`           | :heavy_multiplication_x:                                    | Dict of `php.ini` directives to set for this pool. The value of a directive should be a boolean. Unlike `php_flags`, these values cannot be changed using `ini_set()`. |\n| `php_values`                | :heavy_multiplication_x:                                    | Dict of PHP values to set.                                                                                                                                             |\n| `php_admin_values`          | :heavy_multiplication_x:                                    | Dict of PHP values to set. Unlike `php_values`, these values cannot be changed using `ini_set()`.                                                                      |\n\nOnly the `PHP_INI_PERDIR` and `PHP_INI_ALL` [directives](https://secure.php.net/manual/en/ini.list.php) can be set using `php_flags`, `php_admin_flags`, `php_values` or `php_admin_values`.\n\n\n## Example\n\n```yml\nphp_fpm_pools:\n  - name: fpm-host\n    listen: /path/to/unix/socket\n    user: www-data\n    pm: static\n    pm_max_children: 20\n    pm_start_servers: 20\n    processes_priority: -19\n    envs:\n      TMP: /var/tmp\n    php_admin_values:\n      open_basedir: /var/www\nphp_fpm_php_ini_values:\n  APC:\n    apc.enabled:\n      - 1\n  PHP:\n    extension:\n      - php_mysqli\n      - php_ldap\nphp_fpm_log_level: error\n```\n\n\n## License\n\nThis work is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-sa/4.0/).\n\n\n## Author Information\n\n * [Fritz Otlinghaus (Scriptkiddi)](https://github.com/Scriptkiddi) _fritz.otlinghaus@stuvus.uni-stuttgart.de_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuvusit%2Fphp-fpm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstuvusit%2Fphp-fpm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstuvusit%2Fphp-fpm/lists"}