geoffreyvanwyk.php

Ansible Role for PHP

build

This role installs, configures, and enhances the PHP programming language on Ubuntu servers. You can install multiple versions of PHP on the same server at the same time.

Requirements

If there are any necessary pre-requisites that Ansible or this role does not handle, mention them here. For example, if the role depends on the EC2 module, you should note that the boto package is needed.

Only supported versions of PHP have been tested with this role on long-term support versions of Ubuntu that still receive standard support.

Role Variables

Here are the variables you can set for this role, along with their default values. This includes variables in defaults/main.yml, vars/main.yml, and any variables you can set when using the role. Mention any variables that come from other roles or are global (like hostvars or group vars).

php_version: 8.2

This sets the PHP version you wish to install.


php_mod_enabled: []

This lists the PHP modules (or extensions) you’d like to enable in addition to the default ones. For example:

php_mod_enabled:
  - intl
  - mysql
  - xml

php_mod_disabled: []

This lists the PHP modules (or extensions) you’d like to disable in addition to the default ones. For example:

php_mod_disabled:
  - shmop
  - sockets
  - dom

php_ini_cli: []

These are the PHP settings for the command-line interface (CLI). For example:

php_ini_cli:
  - name: allow_url_fopen
    value: Off
  - name: memory_limit
    value: -1
  - name: date.timezone
    value: "Africa/Johannesburg"

php_ini_apache: []

These are the PHP settings for the Apache web server. For example:

php_ini_apache:
  - name: post_max_size
    value: 128M
  - name: upload_max_filesize
    value: 32M
  - name: max_file_uploads
    value: 2

If you set values for Apache, the role assumes that Apache is installed and will try to restart it after setting those values. If Apache is not installed, the role will fail.


php_ini_fpm: []

These are the PHP settings for the FastCGI Process Manager (FPM) module. For example:

php_ini_fpm:
  - name: max_execution_time
    value: 300
  - name: max_input_time
    value: 600
  - name: max_input_vars
    value: 5000

Dependencies

List other roles hosted on Galaxy here, along with any parameters that need to be set for those roles or variables taken from other roles.

None.

Example Playbook

It's helpful to include an example of how to use your role, showing how to pass variables as parameters.

- hosts: servers
  roles:
    - role: geoffreyvanwyk.php
      php_version: 8.0
      php_mod_enabled:
        - mysql
    - role: geoffreyvanwyk.php
      php_version: 7.4
      php_ini_apache:
        - name: post_max_size
          value: 256M

License

Copyright © 2023 Geoffrey Bernardo van Wyk (https://geoffreyvanwyk.dev)

This file is part of Ansible role geoffreyvanwyk.php.

Ansible role geoffreyvanwyk.php is free software: you can share it and/or modify it under the terms of the GNU General Public License, either version 3 or any later version.

Ansible role geoffreyvanwyk.php is distributed with the hope that it will be useful, but WITHOUT ANY GUARANTEE; without even the implied guarantee of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License with Ansible role geoffreyvanwyk.php. If not, see https://www.gnu.org/licenses/.

Author Information

Geoffrey van Wyk created this role in 2023.

Informazioni sul progetto

Installs, configures and extends the PHP programming language on Ubuntu servers. Multiple versions of PHP can be installed simultaneously on the same server.

Installa
ansible-galaxy install geoffreyvanwyk.php
Licenza
gpl-3.0
Download
3.5k
Proprietario
I first learned computer programming in a module at Stellenbosch University in the '90s. The programming language was Fortran.