drupal-vm
drupal-vm copied to clipboard
Support PHP 8
Issue Type
- Feature Idea
Summary
PHP 8.0.0 was released yesterday: https://www.php.net/archive/2020.php#2020-11-26-3
I will need to update some roles to support it, but it would be nice to be able to support it, and probably bump the default version of PHP to 7.4 now.
Will there be next release with PHP 8 support?
@kom177 - As much as I would like to do it (I'm already using PHP 8 in some systems elsewhere), Drupal itself doesn't yet support PHP 8 :(
See: https://github.com/geerlingguy/drupal-container/issues/32 and https://www.drupal.org/project/drupal/issues/3156651
"PHP 8 is supported from Drupal 9.1.0" https://www.drupal.org/docs/understanding-drupal/how-drupal-9-was-made-and-what-is-included/environment-requirements-of
Hmm... the last time I tried installing it (June) I was running into errors. Maybe it was Drush or some other dependency that still wasn't compatible?
I've stress-tested production site on PHP 8.0.3 and everything worked fine in a week (D9.1.10, D9.2.0 and D9.2.2, core-recommended project with more than 50 contrib modules). But Drush is configured to run under PHP 7.3. I'll try to reconfigure it. UPD. I've changed all PHPs on remote server from 7.4 to 8.0 (for site on D9.2.2, CLI and aliases for drush and composer). Everything seems to work "as designed".
What could we do manually to enable PHP 8 support?
The php-versions role supports PHP 8, so technically if you're on Ubuntu 18.04 or 20.04, or Debian 10/11, you could set php_version
to 8.0
or maybe 8.1 (haven't tried that) and it should work... https://github.com/geerlingguy/ansible-role-php-versions
Jeff, thanks, everything works! (For those who want to switch to PHP 8.0 - don't forget to replace files from release 6.0.4 to very last dev version in provisioning folder).
For new projects and D9 PHP 8 is recommended: https://www.drupal.org/docs/system-requirements/php-requirements
Would be nice to at least have instructions how to get PHP 8.0 provisioned in DrupalVM.
@TipiT
- Download latest drupalvm code https://github.com/geerlingguy/drupal-vm/archive/refs/heads/master.zip and use it as a whole, or replace your provisioning folder
- Change in provisioning/roles/geerlingguy.php-versions/defaults/main.yml php_version: '7.4' to '8.0'
- Change in your config.yml php_version: "7.4" to "8.0"
- Vagrant reload --provision, or better vagrant destroy / vagrant up
- Enjoy
Actually this was (approximately) what I did:
- Change base box in config.yml:
vagrant_box: geerlingguy/ubuntu2004
. Just to get the PHP8 from Ubuntu repo. - Change the
php_version: "8.0"
- Add the role to
installed_extras: - php-versions
- Add the php-versions role:
ansible-galaxy install --roles-path /your/projects/drupal-vm/provisioning/roles geerlingguy.php-versions
- Add a task like provisioning/tasks/install-php8.yml that is like this `- name: Include geerlingguy.php-versions role
include_role:
name: geerlingguy.php-versions
when: '"php-versions" in installed_extras'`
- vagrant up --provision
Looks like it's working but I think only changing the php_version: "8.0"
could be enough. :)
Hi @TipiT Glad to hear that you were able to get it working. Will it be possible for your to share a repo where it is working with all the configuration changes in a single commit?
I am kind of struggling to place which to where.
Thanks.
https://www.drupal.org/project/drupal/issues/3156651 is now closed / fixed and it would be nice to have PHP 8.0 or even 8.1 out of the box, as I cannot învest too much time in fiddeling with other box versions. Is this planned for the near future @geerlingguy ?
@florianmuellerCH - I probably won't work on it; see https://github.com/geerlingguy/drupal-vm/issues/2164
Need help with using php 8 on DrupalVM, these instructions are not clear to me how to do this...
Hi @geerlingguy / @TipiT Could you pls provide more info on updating to PHP 8 in DrupalVM . After updating php_version: "8.0" in box/config.yml and running vagrant reload -- provisioning it throws error as below, failed: E: Package 'php8.0-json' has no installation candidate\n", "rc": 100, "stderr": "E: Package 'php8.0-json' has no installation candidate\n"
I understand that PHP Json package is now part of Core. But how do we exclude this package from being executed , do we need to include the package "geerlingguy/ansible-role-php-versions" along with DRUPAL VM package to support PHP 8 version ?
I got the same issue about php8.0-json
I managed to get this working with these steps:
1 - Since there is no release for the PHP 8 code (https://github.com/geerlingguy/ansible-role-php-versions/blob/master/vars/Debian.yml#L47) I had to require the master branch as 6.0.5 using this command:
composer require --dev "geerlingguy/drupal-vm:dev-master as 6.0.5"
2 - Updated my config.yml
with
vagrant_box: geerlingguy/ubuntu2004
php_version: '8.0'
3 - Manually removed this line from this file that is in the vendor folder https://github.com/geerlingguy/ansible-role-php-versions/blob/master/vars/Debian.yml#L34
4 - Ran vagrant reload --provision
I hope this is helpful.
I wonder if someone could create a new release of drupal-vm to remove step 1. And maybe make the php*-json extension optional based on php version.
Thanks for the response @marcelovani .. I have also made similar steps to make it work like just following step 3 alone works for me .. I was just looking for option where we don't have to modify files inside Vendor folder. Tried to create a separate git repo for geerlingguy/drupal-vm in local repo but didn't work since I have acquia/blt-drupal-vm module which requires stable 5 || 6 version of drupal-vm package.