This Ansible role is designed to install and configure PHP on Debian, by default it installs PHP packaged by Ondřej Surý from [deb.sury.org](https://deb.sury.org/), but it can also be used to install and configure PHP packages from Debian.
This role is tested using `molecule` via [GitLab CI](.gitlab-ci.yml) on Debian Bookworm using [three molecule senarios](molecule/), firstly by installing and configuring the Debian Bookworm PHP CLI Server API (SAPI), secondly installing the Debian Bookworm FPM SAPI and finally installing the Ondřej Surý packages and enabling and starting PHP-FPM pools for PHP 7.4, 8.0, 8.1 and 8.2.
This role is tested using `molecule` via [GitLab CI](.gitlab-ci.yml) on Debian Bookworm using [three molecule senarios](molecule/), firstly by installing and configuring the Debian Bookworm PHP CLI Server API (SAPI), secondly installing the Debian Bookworm FPM SAPI and finally installing the Ondřej Surý packages and enabling and starting PHP-FPM pools for PHP 7.4, 8.0, 8.1, 8.2 and 8.3.
This role enforces unique PHP-FPM pool names across all versions of PHP as this enables better monitoring, by default the `www` pools are renamed to `www82`, `www81` etc.
...
...
@@ -73,12 +73,12 @@ An example `php_config` item:
```yaml
php_config:
-name:PHP 8.2 configuration
version:"8.2"
-name:PHP 8.3 configuration
version:"8.3"
state:present
files:
-name:PHP 8.2 FPM configuration
path:/etc/php/8.2/fpm/php.ini
-name:PHP 8.3 FPM configuration
path:/etc/php/8.3/fpm/php.ini
state:edited
conf:
apc:
...
...
@@ -116,11 +116,11 @@ For example:
```yaml
php_modules:
-name:PHP 8.2 modules
⦙ version:"8.2"
-name:PHP 8.3 modules
⦙ version:"8.3"
⦙ state:present
⦙ sapis:
⦙ ⦙ - name:PHP 8.2 CLI modules
⦙ ⦙ - name:PHP 8.3 CLI modules
⦙ ⦙ ⦙ sapi:cli
⦙ ⦙ ⦙ mods_enabled:
⦙ ⦙ ⦙ ⦙ - apcu
...
...
@@ -140,6 +140,7 @@ The optional `php_verify` variable is `true` by default which results in all var
The optional `php_versions` list is used to install and remove PHP packages, each item in the list requires a `state`, which can be `absent` or `present` and a `version` which must be a string from this list of PHP versions:
```yaml
-"8.3"
-"8.2"
-"8.1"
-"8.0"
...
...
@@ -157,13 +158,13 @@ An example `php_versions` item: