Problem/Motivation
We are using PHP 7.4 on Debian. PHP 7.4 is unsupported by upstream as of today but Debian will maintain it until 2026 (Debian 11 EOL).
The Drupal status report displays an error saying:
Your PHP installation is too old. Drupal requires at least PHP 8.0.
The main problem this causes is that our CI checks if drush rq returns any error and the pipeline fails if it does.
We don't want to ignore errors altogether but we don't want to consider this an error because we know we are using a maintained version.
Steps to reproduce
- Install the Debian php7.4 package.
- Install Drupal 9.
- Browse to
/admin/reports/status.
Proposed resolution
#5. Use drush core:requirements has a --ignore option: https://www.drush.org/latest/commands/core_requirements/
#3307248: Special case Ubuntu PHP versions for some system_requirements() warnings has some discussion about detecting versions maintained by Debian or Ubuntu.
In the mean time, we could add a setting that turns this error into a warning.
Issue fork drupal-3324058
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3324058-add-a-way
changes, plain diff MR !3036
Comments
Comment #3
cilefen commentedComment #4
longwaveYou could use
hook_requirements_alter()in a custom module to alter the severity of this requirement, or remove it entirely. I am not sure this is something we want to be supporting in core.Comment #5
jan.mashat commentedWe came across this warning today, but I'm having trouble deciphering which version of "Drupal requires at least PHP 8.0."
Based on the official PHP requirements, PHP 8.0 is recommended for Drupal 9 - while PHP 7.4 is still supported.
Comment #6
larowlanI think #4 is the answer here, we don't really want to special case things
#4 could even be a contrib module
Comment #7
prudloff commentedWe were a bit surprised too (because we are not used to new errors appearing without upgrading anything) but the error appears when Drupal detects that a PHP version is not supported base on its EOL date: https://git.drupalcode.org/project/drupal/-/blob/f339daf71b0fa703c80501e...
Comment #8
longwave#3261606: Provide more specific messaging about the consequences of using an unsupported PHP version would help with the points raised in #5 and #7.
Comment #9
larowlanAny objection to marking this won't fix?
As per #4 there are ways to suppress it already
Comment #10
prudloff commentedFair enough, I understand why you don't want this in core.
We thought about publishing a contrib module but in the end, this is tied to a particular use case (and is also temporary because because we want to upgrade PHP in case a future security update requires PHP 8) so I think it should go in a custom module.
Comment #11
gaëlgFor anyone meaning to implement hook_requirements_alter(), note that it's not available before 9.5-rc1 (#309040: Add hook_requirements_alter()), and not yet invoked by drush (https://github.com/drush-ops/drush/pull/5327) nor on DB update (#3324995: hook_requirements_alter() is not invoked on update).
But drush core:requirements has a --ignore option: https://www.drush.org/latest/commands/core_requirements/
+1 for "won't fix" though
Comment #12
5IMHO, Drupal 9 should display a warning and not an error in all cases as PHP 7.4 seems to be still supported officially by Drupal 9.
2 occurences of PHP 7.4 found in recent release and none of them anonce that its support was dropped:
- https://www.drupal.org/project/drupal/releases/9.4.0
- https://www.drupal.org/project/drupal/releases/9.5.0
The documentation also doesn't relate the support was dropped neither : https://www.drupal.org/docs/system-requirements/php-requirements.
Actually, many OS in LTS version include a supported PHP 7.4. For example, the popular Ubuntu 20.04 will support PHP 7.4 until 2025. I think I remember this fact was written in a previous version of https://www.drupal.org/docs/system-requirements/php-requirements
In my company, we used to relied on the PHP 7.4 support in order to concentrate our D10 upgrade efforts in 2023: we will migrate PHP to 8.X for our websites along with the upgrade to Drupal 10.
Comment #14
5To continue the precedent comment, examples about Ubuntu: PHP 7.4 is maintained by Ubuntu 20.04 and will be freely until 2025. See there that, like many other distributions, "For each Ubuntu LTS release, Canonical maintains the Base Packages and provides security updates, including kernel livepatching, for a period of ten years.". And see here that the PHP 7.2 version embeded in Ubuntu 18.04 is still effectively maintained.
And here is the change that introduced the "error" level automatically on PHP versions: https://www.drupal.org/node/3261447
Comment #15
jweowu commentedI'm marking this as a bug and bumping the priority to "major" for the reasons stated in #3328940: Drupal 9.4.x incorrectly reporting PHP 8 as a requirement:
and:
I also disagree with adding some kind of option to be truthful whilst defaulting to a lie. That doesn't help with the primary issue here. The correct messaging should be the default messaging (and there's no need for any new option if that bug is fixed).
Comment #16
finn lewisI am trying to run update.php on a site running Drupal 9.5.3 and 7.4.3-4ubuntu2.17
It seems that the PHP version warning is preventing me running update.php.
I am seeing this message on a Drupal
And then below, just
It doesn't look like there are any other warnings or errors, so it seems this is blocking running update.php.
Comment #18
quietone commentedComment #19
catchThis should only be a warning on update, and update.php should allow you to continue despite warnings.
@Finn Lewis Have you actually tried clicking the 'try again' link? That should take you to the next page if only warnings are shown on the first one. The fact it doesn't inform you about this seems like a usability issue we could open a separate issue for, since it doesn't only result due to PHP version.
I think it would be fine to show a warning instead of error on runtime too. The main place we wanted an error was on install, precisely because it's harder to migrate hosting once you have a site installed, by showing an error on install, people can sort things out before they have a database and files to worry about.
Comment #21
prudloff commentedLooking back at this, I agree that special cases like this should not be added to core. It could lead to users running unsecure PHP versions or being unable to apply security updates.
If you are sure your PHP version is maintained, you can alter the error with hook_requirements_alter().