Install and configure PHP, typically for use with Drupal sites in Acro Media NGINX + FPM hosting environments.
- Ubuntu LTS (20.04 or newer)
- The default CLI version of php to set on the server.
- Defaults to
8.3
- The default maximum memory limit
- Applies to all php versions installed
- Defaults to
256M
.
- The maximum number of input vars that can be accepted in a POST request
- Drupal typically needs this way higher than the default
- Applies to all php versions installed
- Defaults to
3001
.
- A list of versions to install.
- Defaults to
[ {{php_default_version}} ]
.
- See defaults/main.yml - Up to and including PHP 8.0, the add_modules and default modules list were version-specific variables.
- A list of extra apt packages not already included in the default list. See defaults/main.yml.
- The modules you specify must be the full name of the apt package to install. (See example playbook below)
- Defaults to an empty list.
[]
- Not defined by default, so the role can define it and populated it, based on the combination of
php_versions
andphp_default_module_name_suffixes
(see defaults/main.yml) - If you define this var in your playbook, your var will completely override the ENTIRE list of ALL modules, for ANY PHP >= 8.1 version that the role would normally install. E.g. If you have multiple versions of php installed, you'll need to specify all modules for every version yourself.
- Defaults to
true
- For compatibility with older playbooks that have been using the role, and have custom module specifications.
- Setting this to
false
will let the role the use 8.1-style package name generator for all (older) php versions, as well as 8.1 and beyond. - If your role doesn't use any version specific lists (see defaults/main.yml), then it's safe to set this to
false
.
None
- name: Install + Configure PHP
hosts: servers
gather_facts: yes
become: yes
vars:
php_default_version: '8.1'
php_versions:
- '7.4'
- '8.0'
- '8.1'
php_add_modules:
- php7.4-foo
- php8.0-foo
- php8.1-foo
- php8.1-bar
# php_use_legacy_module_lists: ... See variable documentation.
roles:
- role: acromedia.php
tags:
- php
GPLv3
Acro Media Inc. https://www.acromedia.com/