Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
Fixes #1993: Add PHP 7.4 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
geerlingguy committed Dec 2, 2019
1 parent 4a7c7d2 commit ac77e1e
Show file tree
Hide file tree
Showing 15 changed files with 53 additions and 58 deletions.
2 changes: 1 addition & 1 deletion default.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ firewall_log_dropped_packets: false
firewall_disable_firewalld: true
firewall_disable_ufw: true

# PHP Configuration. Currently-supported versions: 7.1, 7.2, 7.3.
# PHP Configuration. Currently-supported versions: 7.2, 7.3, 7.4.
# See version-specific notes: http://docs.drupalvm.com/en/latest/configurations/php/
php_version: "7.2"
php_install_recommends: no
Expand Down
10 changes: 5 additions & 5 deletions docs/configurations/php.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
Drupal VM defaults to PHP 7.2, but you can also install and use 7.1 or 7.3.
Drupal VM defaults to PHP 7.2, but you can also install and use 7.3 or 7.4.

## Ubuntu

Ondřej Surý's PPA for PHP is used to install PHP 7.2, but you can switch versions by changing `php_version` inside `config.yml` to `"7.1"` or `"7.3"`.
Ondřej Surý's PPA for PHP is used to install PHP 7.2, but you can switch versions by changing `php_version` inside `config.yml` to `"7.3"` or `"7.4"`.

If you're using Apache with `mod_php` you should also add `libapache2-mod-php{{ php_version }}` to the `extra_packages` list.

_Note: XHProf does currently not work with PHP 7.1+, make sure you don't have it listed in `installed_extras`._

## RedHat/CentOS 7
## RedHat/CentOS 7 or 8

Remi's RPM repository is included with Drupal VM, and you can make the following changes to use it to install a different version of PHP than 7.2:

1. Make sure you've followed the directions for switching to CentOS 7 in the [use a different base OS](base-os.md) guide.
2. Change `php_version` inside `config.yml` to `"7.1"` or `"7.3"`.
2. Change `php_version` inside `config.yml` to `"7.3"` or `"7.4"`.

## PHP 5.6 EOL

PHP 5.6 was end-of-lifed (meaning no more community support or security fixes) at the end of 2018. Drupal VM does not officially support PHP 5.6 anymore, though some package maintainers are still publishing packages for it. So you can try using `php_version: "5.6"` or using PHP's source installation at your own risk.
PHP 5.6 was end-of-lifed (meaning no more community support or security fixes) at the end of 2018, and is not supported by Drupal VM.

## Using default distribution packages

Expand Down
2 changes: 1 addition & 1 deletion provisioning/requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
- src: geerlingguy.php-tideways
version: 2.2.0
- src: geerlingguy.php-versions
version: 3.1.3
version: 4.0.0
- src: geerlingguy.php-xdebug
version: 2.5.1
- src: geerlingguy.php-xhprof
Expand Down
27 changes: 13 additions & 14 deletions provisioning/roles/geerlingguy.php-versions/.travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,27 @@ env:
global:
- ROLE_NAME: php-versions
matrix:
# Default PHP version (7.2).
# Default PHP version (7.3).
- MOLECULE_DISTRO: centos8
- MOLECULE_DISTRO: centos7
- MOLECULE_DISTRO: ubuntu1804
- MOLECULE_DISTRO: ubuntu1604
- MOLECULE_DISTRO: debian9
- MOLECULE_DISTRO: debian10

# PHP 7.3.
- MOLECULE_DISTRO: centos7
# PHP 7.4.
- MOLECULE_DISTRO: centos8
MOLECULE_DOCKER_COMMAND: /usr/lib/systemd/systemd
MOLECULE_PLAYBOOK: playbook-7.3.yml
MOLECULE_PLAYBOOK: playbook-7.4.yml
- MOLECULE_DISTRO: ubuntu1804
MOLECULE_PLAYBOOK: playbook-7.3.yml
- MOLECULE_DISTRO: ubuntu1604
MOLECULE_PLAYBOOK: playbook-7.3.yml
- MOLECULE_DISTRO: debian9
MOLECULE_PLAYBOOK: playbook-7.3.yml
MOLECULE_PLAYBOOK: playbook-7.4.yml
- MOLECULE_DISTRO: debian10
MOLECULE_PLAYBOOK: playbook-7.4.yml

# PHP 7.1.
- MOLECULE_DISTRO: centos7
MOLECULE_PLAYBOOK: playbook-7.1.yml
# PHP 7.2.
- MOLECULE_DISTRO: centos8
MOLECULE_PLAYBOOK: playbook-7.2.yml
- MOLECULE_DISTRO: ubuntu1804
MOLECULE_PLAYBOOK: playbook-7.1.yml
MOLECULE_PLAYBOOK: playbook-7.2.yml

install:
# Install test dependencies.
Expand Down
6 changes: 3 additions & 3 deletions provisioning/roles/geerlingguy.php-versions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ N/A

Available variables are listed below, along with default values (see `defaults/main.yml`):

php_version: '7.2'
php_version: '7.3'

The PHP version to be installed. Any [currently-supported PHP major version](http://php.net/supported-versions.php) is a valid option (e.g. `5.6`, `7.1`, `7.2`, `7.3`, etc.).
The PHP version to be installed. Any [currently-supported PHP major version](http://php.net/supported-versions.php) is a valid option (e.g. `7.2`, `7.3`, `7.4` etc.).

php_versions_install_recommends: false

Expand All @@ -30,7 +30,7 @@ The PHP version to be installed. Any [currently-supported PHP major version](htt
- hosts: webservers

vars:
php_version: '7.2'
php_version: '7.3'

roles:
- role: geerlingguy.repo-remi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# The PHP version to be installed.
php_version: '7.2'
php_version: '7.3'

# For Debian OSes only.
php_versions_install_recommends: false
2 changes: 1 addition & 1 deletion provisioning/roles/geerlingguy.php-versions/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ galaxy_info:
description: Allows different PHP versions to be installed.
company: "Midwestern Mac, LLC"
license: "MIT"
issue_tracker_url: https://github.com/geerlingguy/drupal-vm/issues
issue_tracker_url: https://github.com/geerlingguy/ansible-role-php-versions/issues
min_ansible_version: 2.4
platforms:
- name: EL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

vars:
php_enable_webserver: false
php_version: '7.1'
php_version: '7.2'

pre_tasks:
- name: Update apt cache.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

vars:
php_enable_webserver: false
php_version: '7.3'
php_version: '7.4'

pre_tasks:
- name: Update apt cache.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

vars:
php_enable_webserver: false
php_version: '7.2'

pre_tasks:
- name: Update apt cache.
Expand Down
6 changes: 0 additions & 6 deletions provisioning/roles/geerlingguy.php-versions/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,3 @@

# Setup tasks.
- include_tasks: "setup-{{ ansible_os_family }}.yml"

- name: Set the correct XHProf package when PHP 5.6 is used.
set_fact:
xhprof_download_url: https://github.com/phacility/xhprof/archive/master.tar.gz
xhprof_download_folder_name: xhprof-master
when: php_version == '5.6'
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@
apt_repository: repo='ppa:ondrej/php'
when: ansible_distribution == "Ubuntu"

- name: Add repository for PHP 5 compatibility packages (Ubuntu).
apt_repository: repo='ppa:ondrej/php5-compat'
when:
- php_version == "5.6"
- ansible_distribution == "Ubuntu"
- ansible_distribution_release != "bionic"

# Debian-specific tasks.
- name: Add dependencies for PHP versions (Debian).
apt:
Expand Down
37 changes: 25 additions & 12 deletions provisioning/roles/geerlingguy.php-versions/tasks/setup-RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
---
- name: Enable remi repo for PHP 5.6.
set_fact: php_enablerepo="remi,remi-php56"
when: php_version == "5.6"

- name: Enable remi repo for PHP 7.0.
set_fact: php_enablerepo="remi,remi-php70"
when: php_version == "7.0"

- name: Enable remi repo for PHP 7.1.
set_fact: php_enablerepo="remi,remi-php71"
when: php_version == "7.1"

- name: Enable remi repo for PHP 7.2.
set_fact: php_enablerepo="remi,remi-php72"
when: php_version == "7.2"

- name: Enable remi repo for PHP 7.3.
set_fact: php_enablerepo="remi,remi-php73"
when: php_version == "7.3"

- name: Enable remi repo for PHP 7.4.
set_fact: php_enablerepo="remi,remi-php74"
when: php_version == "7.4"

# See: https://github.com/ansible/ansible/issues/64852
- block:
- name: Ensure dnf-plugins are installed on CentOS 8+.
yum:
name: dnf-plugins-core
state: present

- name: Enable DNF module for CentOS 8+.
shell: |
dnf config-manager --set-enabled PowerTools
dnf module enable -y php:remi-{{ php_version }}
args:
warn: false
register: dnf_module_enable
changed_when: "'Nothing to do' not in dnf_module_enable.stdout"

- debug: var=dnf_module_enable
when:
- ansible_os_family == 'RedHat'
- ansible_distribution_major_version | int >= 8
3 changes: 0 additions & 3 deletions provisioning/roles/geerlingguy.php-versions/vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,5 @@ __php_packages:
- "php{{ php_version }}-yaml"

php_versions_debian:
- php5.6-common
- php7.0-common
- php7.1-common
- php7.2-common
- php7.3-common
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
php_version: "7.3"
php_version: "7.4"
php_sendmail_path: "/usr/sbin/sendmail -t -i"
installed_extras: []

0 comments on commit ac77e1e

Please sign in to comment.