Page MenuHomePhabricator

Require either PHP 7.0+ or HHVM in MW 1.31
Closed, ResolvedPublic

Tokens
"Love" token, awarded by Lucas_Werkmeister_WMDE."Like" token, awarded by Liuxinyu970226."Like" token, awarded by MacFan4000."Like" token, awarded by Florian."Like" token, awarded by Smalyshev."Like" token, awarded by Aleksey_WMDE."Like" token, awarded by Addshore."Mountain of Wealth" token, awarded by thiemowmde."Mountain of Wealth" token, awarded by Ricordisamoa.
Assigned To
Authored By
MaxSem, Aug 1 2017

Description

Current proposal

  • MediaWiki 1.31 will require either PHP 7.0 or later, or HHVM.
  • Developers will target the common subset of HHVM (with hhvm.php7.all = false) and PHP 7.0+.
  • CI will enforce the use of this common subset using phpcs and/or phan rules
  • These changes will be deferred until MediaWiki in WMF production is fully migrated to a compatible environment. See the subtasks of this RFC. The deadline for this work is April 1, 2018.

Rationale

Pingbacks

Current PHP version statistics (as of 2018-03-04) from install pingbacks (this feature was introduced in 1.28 so all this data is from the era when PHP 5.5 was required):

CountPHP version
164295.6
155667.0
86437.1
28705.5
13707.2

See also complete pingback statistics. From MW 1.29, there are more installations with PHP 7.0 than 5.6.

WMF

One obstacle is that while WMF uses HHVM for MediaWiki, some other services are using Zend PHP, so we can't bump the requirements until all appservers have been updated to Debian Stretch.

External support

PHP Security SupportDebian supportUbuntu supportFedora supportPHPUnit
PHP 5.5ended July 2016noneuntil April 2019 (Ubuntu 14 Trusty)noneended Feb 2017 (PHPUnit 4)
PHP 5.6until Dec 2018until April 2020 (Debian Jessie)noneended Aug 2017 (Fedora 24)ended Feb 2018 (PHPUnit 5)
PHP 7.0until Dec 2018until June 2022 (Debian Stretch)until April 2021 (Ubuntu 16 Xenial)until Dec 2017 (Fedora 25)until Feb 2019 (PHPUnit 6)
PHP 7.1until Dec 2019futurefutureuntil Aug 2018 (Fedora 26)future

PHPUnit support: We're currently using PHPUnit 4.x (https://phpunit.de/), and have to because we run the tests on PHP 5.5 in CI and newer PHPUnit versions require at least PHP 5.6.

PHPUnit 4Supported PHP 5.3 - PHP 5.6No longer supported (March 2014 - Feb 2017)
PHPUnit 5Supports PHP 5.6 - PHP 7.1Legacy support (Oct 2015 - Feb 2018)
PHPUnit 6Supports PHP 7.0 - PHP 7.1Current stable (Feb 2017 - Feb 2019)

PHP Security support: http://php.net/supported-versions.php, http://php.net/eol.php

Distro support: https://wiki.debian.org/LTS, https://wiki.ubuntu.com/Releases, https://fedoraproject.org/wiki/End_of_life, https://apps.fedoraproject.org/packages/php

MediaWiki version lifecycle

https://www.mediawiki.org/wiki/Version_lifecycle / https://www.mediawiki.org/wiki/Compatibility

ReleasePHPEOL
MediaWiki 1.27 LTSPHP 5.5 - 7.1June 2019
MediaWiki 1.28PHP 5.5 - 7.0November 2017
MediaWiki 1.29PHP 5.5 - 7.1July 2018
MediaWiki 1.30PHP 5.5 - 7.1November 2018
MediaWiki 1.31 LTSTBDJune 2021

See also:

Related Objects

StatusAssignedTask
ResolvedJdforrester-WMF
Resolvedfgiunchedi
ResolvedEBernhardson
ResolvedKrenair
ResolvedNone
Resolvedhashar
Resolvedtstarling
Resolvedtstarling
ResolvedArielGlenn
ResolvedArielGlenn
ResolvedArielGlenn
ResolvedArielGlenn
ResolvedNone
ResolvedLegoktm
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
Resolvedbd808
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedAndrew
ResolvedMaxSem
ResolvedLegoktm
ResolvedLegoktm
ResolvedLegoktm
ResolvedNone
ResolvedAnomie
ResolvedImarlier
ResolvedNone
ResolvedDzahn
ResolvedRobH
ResolvedCmjohnson
ResolvedMoritzMuehlenhoff
ResolvedPapaul
ResolvedSmalyshev
Resolvedjcrespo
ResolvedJdforrester-WMF

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Seb35 updated the task description. (Show Details)Mar 13 2018, 1:30 PM

Titile should be changed to Require PHP 7.0+ in MW 1.31?

Since we have decided that we are going with php 7+.

Krinkle added a comment.EditedApr 18 2018, 2:49 AM

That is incorrect. The title accurately reflects the RFC decision that we are implementing.

Change 427458 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/core@REL1_31] Bump PHP version requirement to 7.0.0+

https://gerrit.wikimedia.org/r/427458

Krinkle moved this task from Backlog to Core on the MW-1.31-release board.Apr 18 2018, 6:08 PM

Change 427458 merged by jenkins-bot:
[mediawiki/core@REL1_31] Bump PHP version requirement to 7.0.0+

https://gerrit.wikimedia.org/r/427458

Change 427458 merged by jenkins-bot:
[mediawiki/core@REL1_31] Bump PHP version requirement to 7.0.0+
https://gerrit.wikimedia.org/r/427458

Does this mean that we can use the new features (new syntax) of PHP 7?

Krinkle added a comment.EditedApr 19 2018, 12:06 AM

@RazeSoldier No, not yet. It was merged in REL1_31 for the upcoming 1.31 release candidate, but not yet in master. Once it lands in master (should be a few weeks at most), the linter and style checker may be changed to allow newer syntax features.

Also note that most of the new php7 syntax won't be available until we stop supporting hhvm. (T176370)

Technically this is now done (for MW 1.31), but I'm planning only to declare this actually Resolved once master is switched too.

Also note that most of the new php7 syntax won't be available until we stop supporting hhvm. (T176370)

HHVM supports many PHP7 features even when hhvm.php7.all or similar configuration options aren't set. A partial list is mentioned in T172165#3699606.

Should we have a formal list/guidelines of what is allowed and what is not, once the switch is done, somewhere on wiki? At least for the period when hhvm support is still required.

Reedy added a comment.Apr 19 2018, 9:01 PM

Should we have a formal list/guidelines of what is allowed and what is not, once the switch is done, somewhere on wiki? At least for the period when hhvm support is still required.

Do remember master will be supporting PHP 5.5 for a little while longer too.

It may be easier to just keep PHP 7 features out till HHVM support is actually dropped... HHVM supports some, but we don't have php7 mode enabled (for backwards incompatible stuff)

Though, if tests run on HHVM pass..

I note we specifically did this "PHP 7.0+ or HHVM in MW 1.31" so we could start using the PHP7 features that HHVM does support. Once master drops PHP5, of course.

According to Anomie's previous comments (T172165#3699606), HHVM supports all PHP 7 syntax features, except where PHP 7 intentionally breaks compatibility with PHP 5 syntax: T173786#3651007.

Note that there are a few patches already pending that would introduce uses of some new features: https://gerrit.wikimedia.org/r/#/q/status:open+(topic:new-php+OR+topic:newphp). If you want to discuss disallowing specific features in our code conventions, now is probably time for it :)

What exactly is blocking master to require PHP 7, if even 1.31 is already requiring it?

For it to be upgraded in wmf prod.

Is there a date set when to do this? I assumed HHVM compatibility would cover our needs.

Reedy added a comment.Apr 20 2018, 7:36 AM

What exactly is blocking master to require PHP 7, if even 1.31 is already requiring it?

T181029#4142688 - Hopefully it should only be a couple of weeks

We've some hosts that still run 5.5, but we don't run 1.31 in production (and it's got a little while till being ready)

Is there a date set when to do this? I assumed HHVM compatibility would cover our needs.

HHVM supports PHP 7 features that PHP 5.5 doesn't, so we still can't have those as the hosts aren't running HHVM, they're running PHP 5.5.

So it's easiest to just keep master free (for now), rather than reverting in WMF branches and then potentially reverting extra patches.

It's coming, and it's nearly there. In the grand scheme of things, there's no major need to "rush" and start adding PHP 7 features everywhere, unless they bring reasonable gains from doing so... A few more weeks is nothing in the grand scheme of things :)

gh87 added a subscriber: gh87.EditedApr 20 2018, 8:03 AM

PHP 7.0 will be supported until December of this year: http://php.net/archive/2018.php#id2018-01-04-1

The task should be changed from "7.0+" to "7.1+", and Its "PHP Security Support" year should be corrected from "Dec 2019" to "Dec 2018".

Reedy added a comment.Apr 20 2018, 8:08 AM

PHP 7.0 will be supported until December of this year: http://php.net/archive/2018.php#id2018-01-04-1
The task should be changed from "7.0+" to "7.1+", and the support end-year should be corrected from "Dec 2019" to "Dec 2018"

No, because that wasn't agreed on in the RfC.

In the same way we've supported other versions of unsupported PHP (like we currently do for PHP 5.5), we'll support PHP 7. Hosting providers don't upgrade quickly, and neither do many other sysadmins and users.

gh87 updated the task description. (Show Details)Apr 20 2018, 8:23 AM
demon moved this task from Core to Done on the MW-1.31-release board.May 15 2018, 1:13 PM
ArielGlenn added a comment.EditedMay 22 2018, 9:47 AM

As mentioned a couple of days ago, some jobs on terbium are still running with php5; those are the jobs that run via foreachwiki as www-data which calls foreachwikiindblist.
A list of those jobs is here: P7139

There's two options.
One: fix foreachwikindblist so it doesn't use php5 but whatever /usr/bin/php points to, which on terbium would be hhvm. Someone(s) should feel confident that the above jobs run well on hhvm before such a change is deployed.
Two: wait for terbium's replacement (mwmaint1001) to become the live server. See T192092 This would happen sometime after the tin -> deploy1001 switchover, which is currently scheduled for May 25, see T175288#4205322 In this case, someone(s) should feel confident that the above jobs run well on php7.0.

Can folks discuss and get us a plan?

gh87 removed a subscriber: gh87.May 22 2018, 10:11 AM

Change 434922 had a related patch set uploaded (by Reedy; owner: Reedy):
[integration/config@master] Don't run php55 jobs on master (REL1_32)

https://gerrit.wikimedia.org/r/434922

Change 434922 merged by jenkins-bot:
[integration/config@master] Don't run php55 jobs on master (REL1_32) or wmf/ branches

https://gerrit.wikimedia.org/r/434922

Change 405216 merged by jenkins-bot:
[mediawiki/core@master] Bump PHP version requirement to 7.0.0+

https://gerrit.wikimedia.org/r/405216

Reedy closed this task as Resolved.May 24 2018, 4:19 PM
Reedy assigned this task to Jdforrester-WMF.
Reedy removed a project: Patch-For-Review.

Boom

Will WMF be able to run (full) PHP 7.1 any time soon? (Note: I am not asking about bumping MW to 7.1, just when WMF will be able to run it.)

Reedy added a comment.May 25 2018, 2:53 PM

Will WMF be able to run (full) PHP 7.1 any time soon? (Note: I am not asking about bumping MW to 7.1, just when WMF will be able to run it.)

I don’t think so. Depends when next Debian stable has 7.1, and the next round of reinstalls happen...

EddieGP added a comment.EditedMay 25 2018, 2:54 PM

Will WMF be able to run (full) PHP 7.1 any time soon? (Note: I am not asking about bumping MW to 7.1, just when WMF will be able to run it.)

See T176370: Migrate to PHP 7 in WMF production. WMF is currently migrating to PHP7.0 aiui.

JeroenDeDauw added a comment.EditedMay 28 2018, 9:18 PM

That is the issue I came from actually.

Question 1: So WMF is definitely going to 7.0 and not 7.1 or 7.2?!
Question 2: When will WMF be able to run full PHP 7.0?

I think there planning to do 7.2 (that’s what was discussed when copying the php 7.2 packages over for phabricator).

But they will be going to php 7.0 first.

Reedy added a comment.May 28 2018, 9:58 PM

That is the issue I came from actually.
Question 1: So WMF is definitely going to 7.0 and not 7.1 or 7.2?!
Question 2: When will WMF be able to run full PHP 7.0?

Why are you asking the same questions on numerous different tasks?

Any ETA on when WMF will be able to run full PHP 7.0? And will it be running PHP 7.0 or a more recent version of 7.x?

7.0.27-0+deb9u1

Because Debian Stretch.

https://packages.debian.org/stretch/php7.0

Why are you asking the same questions on numerous different tasks?

Because I got linked here and still did not get a clear answer. As in: still not. "7.0.27-0+deb9u1" is not a date and I do not know how to translate it to one.

So:

Question 1: So WMF is definitely going to 7.0 and not 7.1 or 7.2?!
Question 2: When will WMF be able to run full PHP 7.0?

Reedy added a comment.May 29 2018, 9:27 PM

Why are you asking the same questions on numerous different tasks?

Because I got linked here and still did not get a clear answer. As in: still not. "7.0.27-0+deb9u1" is not a date and I do not know how to translate it to one.

You were also asking the question around/on a long holiday weekend. Patience might be needed to get full/proper responses. People do have lives and time off.

Try also reading the responses to your questions, and the tasks/comments they link

T174431#4198574
Should be a few weeks before we have PHP 7 available everywhere.
There's still work to move from hhvm to PHP7 for actual production

It's going to be 7.0.X initially, at least, yes. 7.1/7.2 will come sometime in the future (possibly with OS upgrades, possibly before).

We're waiting on a couple more hosts being migrated away from having PHP5 to having PHP 7, this is due to be finished off shortly

And define "full PHP 7.0"? There's some divergence between PHP7 and HHVM. So, the functionality that HHVM implements differently. So, while HHVM is still in use, PHP7 functionality that isn't in HHVM (or differently implemented) cannot be used.

Reedy added a comment.May 29 2018, 9:33 PM

Question 1: So WMF is definitely going to 7.0 and not 7.1 or 7.2?!

And all that aside, MW needs to be 7.0 compatible (as per the RfC), so it doesn't matter if WMF is running 7.1 or 7.2

Krinkle added a comment.EditedMay 29 2018, 9:34 PM

Question 1: So WMF is definitely going to 7.0 and not 7.1 or 7.2?!

Yes, that was decided last year and is what everyone's been working on. The Debian upgrade is already underway, and there probably isn't enough reason to re-allocate existing bandwidth and priorities from other projects to do a second Debian-PHP migration this/next quarter.

More about this at T176370: Migrate to PHP 7 in WMF production.

Question 2: When will WMF be able to run full PHP 7.0?

Per:
https://www.mediawiki.org/wiki/Wikimedia_Technology/Goals/2017-18_Q4#Technology_departmental_programs

Current quarter is:

  • Phase out all use of PHP 5.
  • Upgrade production app servers from Debian Jessie to Stretch (still with HHVM).
  • Switch some servers to PHP 7 (Beta Cluster, and deployment/maintenance hosts).

Running PHP 7 for the main application servers requires other preparations to be in place first. Including profiling, logging and error handling, which various teams are also working on this quarter so that later this year we can consider switching application servers from HHVM to PHP 7.

More about this at T176370.

Now, can we define Array constants with define()? It is a new feature of PHP 7.

Reedy added a comment.Jun 1 2018, 12:54 PM

Now, can we define Array constants with define()? It is a new feature of PHP 7.

As long as they are features that don't require HHVM's PHP 7 mode to be on

See https://docs.hhvm.com/hhvm/configuration/INI-settings#php-7-settings for more information