server icon indicating copy to clipboard operation
server copied to clipboard

Support PHP8.2

Open ChristophWurst opened this issue 2 years ago • 7 comments

How to use GitHub

  • Please use the 👍 reaction to show that you are interested into the same feature.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Is your feature request related to a problem? Please describe.

PHP8.1 is the latest and greatest PHP. One day there will be 8.2 and it would be cool if Nextcloud can support it reasonably early. Not too early where it is unstable, but as soon as the support libraries are ready and there are no known issues.

Describe the solution you'd like

As a first step: have PHP8.2 nightly included in CI builds ASAP. Later: include official 8.2 support once it's stable.

Describe alternatives you've considered

N/a

Additional context

  • https://github.com/nextcloud/server/issues/29287

ChristophWurst avatar May 25 '22 14:05 ChristophWurst

8.2 support on server is tested in https://github.com/nextcloud/server/pull/32463

come-nc avatar Aug 01 '22 10:08 come-nc

https://github.com/phpseclib/phpseclib/issues/1808 This fix on phpseclib side is needed for 8.2 support.

come-nc avatar Aug 30 '22 15:08 come-nc

Nextcloud 25.0.1 seems to work fine on PHP 8.2.0 RC 6. Will support for PHP 8.2 be officially enabled in the upcoming 25.0.2 or 25.0.3? PHP 8.2 release is planned for 24 November 2022.

mzary avatar Nov 11 '22 08:11 mzary

Nextcloud 25.0.1 seems to work fine on PHP 8.2.0 RC 6. Will support for PHP 8.2 be officially enabled in the upcoming 25.0.2 or 25.0.3? PHP 8.2 release is planned for 24 November 2022.

No, PHP 8.2 support should come with Nextcloud 26 most likely. We need to bump several dependencies and adapt our code to make it warning-free before we officially support 8.2.

come-nc avatar Nov 14 '22 08:11 come-nc

Currently missing:

  • [x] https://github.com/nextcloud/server/issues/29731 is needed (PR https://github.com/nextcloud/server/pull/30349 - WIP - see unchecked checkboxes in the comments. Also not tested)
  • [x] doctrine/dbal needs to be bumped to something newer than 3.3.7. Failed attempt: https://github.com/nextcloud/server/pull/35084
  • [x] #34819
  • [ ] All the other errors

come-nc avatar Nov 15 '22 16:11 come-nc

(moved up to ticket description)

come-nc avatar Nov 24 '22 11:11 come-nc

I think this has to be changed on the master branch to allow apps to start testing against PHP 8.2: https://github.com/nextcloud/server/blob/d635d58d19d5ab65c0be754fc32fce99672c249f/lib/versioncheck.php#L37

susnux avatar Dec 23 '22 23:12 susnux

Hi guys Unfortunately Nextcloud 25.0.2 still does not run under PHP>=8.2.x. Current version is 8.2.1. Is there anything you can do or you have to use the old PHP 8.1 from November 2021 ? Greeting @Niffecs

image

ghost avatar Jan 15 '23 19:01 ghost

For the Arch Linux users coming here see https://wiki.archlinux.org/title/Nextcloud#Migrating_to_php-legacy

C0rn3j avatar Jan 15 '23 23:01 C0rn3j

Currently you can also easily downgrade from PHP8.X to PHP7.4. After that everything should work again.

From most instructions

# From most instructions on how to install Nextcloud
sudo apt update && apt upgrade -y
sudo apt install apache2
sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo  apt update
# and so on

Downgrade 8.X -> 7.4

Then you can simply downgrade by manually removing PHP8.X and then manually installing PHP7.4.

sudo apt-get purge php8.
sudo apt-get autoclean
sudo apt-get autoremove
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt -y install php7.4
php -v

Result:

Output
PHP 7.4.0beta4 (cli) (built: Aug 28 2019 11:41:49) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.0beta4, Copyright (c), by Zend Technologies

Other PHP7.4 Packages

sudo apt-get install -y php7.4-cli php7.4-json php7.4-common php7.4-mysql php7.4-zip php7.4-gd php7.4-mbstring php7.4-curl php7.4-xml php7.4-bcmath

Source:

  • https://askubuntu.com/questions/59886/how-to-completely-remove-php
  • https://www.digitalocean.com/community/tutorials/how-to-install-php-7-4-and-set-up-a-local-development-environment-on-ubuntu-20-04
  • https://apfelcast.com/nextcloud-24-auf-ubuntu-22-04-installieren-einfache-schritt-fuer-schritt-anleitung/

@szaimen This makes issue #36148 moot. However, it would still be really handy if Nextcloud supports the new PHP versions.

ghost avatar Jan 16 '23 00:01 ghost

@Niffecs PHP 7.x is EOL and should not be used, latest Nextcloud runs just fine on 8.1.

https://www.php.net/supported-versions.php

C0rn3j avatar Jan 16 '23 19:01 C0rn3j

People should just look at https://docs.nextcloud.com/server/latest/admin_manual/installation/system_requirements.html#system-requirements

So yes, PHP 8.1 is just fine at the moment.

bcutter avatar Jan 16 '23 20:01 bcutter

Hi @C0rn3j and @bcutter, What other site packages do you have installed? So besides the PHP 8.1 version?

ghost avatar Jan 16 '23 22:01 ghost

Hi @C0rn3j and @bcutter,

What other site packages do you have installed? So besides the PHP 8.1 version?

From the top of my mind 7.4, 8.0, 8.1 and 8.2. Manually set 8.1 as my choice to remain NC stable (back in time apt upgrade set 8.2 and NC stopped working) so I don't care of all the others shipped with my distro. Once NC is able to deal with, I switch over to 8.2 within few minutes.

bcutter avatar Jan 16 '23 22:01 bcutter

Here's what i do when i have a server running PHP 8.1 & PHP 8.2. I just change it so it runs on 8.1. then once its supported change it back to 8.2

sudo a2dismod php8.2
sudo a2enmod php8.1
sudo service apache2 restart
sudo update-alternatives --config php
sudo update-alternatives --config phar
sudo update-alternatives --config phar.phar
sudo service apache2 restart

AndyXheli avatar Jan 17 '23 20:01 AndyXheli

Debian Bookworm just moved to PHP 8.2 and started dropping PHP 8.1 packages/modules, like APCu. Would be great to have PHP 8.2 support with NC26 enabled.

MichaIng avatar Jan 18 '23 15:01 MichaIng

I adjusted the /lib/versioncheck.php on my NC 25.0.3 and moved to PHP 8.2, and it actually works pretty well with my rather small set of enabled apps:

Enabled:
  - activity: 2.17.0
  - apporder: 0.15.0
  - calendar: 4.2.1
  - cloud_federation_api: 1.8.0
  - contacts: 5.0.2
  - dashboard: 7.5.0
  - dav: 1.24.0
  - federatedfilesharing: 1.15.0
  - files: 1.20.1
  - files_rightclick: 1.4.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - impersonate: 1.11.0
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - notes: 4.6.0
  - notifications: 2.13.1
  - notify_push: 0.5.0
  - oauth2: 1.13.0
  - photos: 2.0.1
  - provisioning_api: 1.15.0
  - ransomware_protection: 1.14.0
  - settings: 1.7.0
  - survey_client: 1.13.0
  - tasks: 0.14.5
  - theming: 2.0.1
  - twofactor_backupcodes: 1.14.0
  - updatenotification: 1.15.0
  - viewer: 1.9.0
  - workflowengine: 2.7.0
Disabled:
  - admin_audit
  - bruteforcesettings
  - circles: 22.0.0-alpha.9
  - comments: 1.2.0
  - contactsinteraction: 1.1.0
  - encryption
  - federation: 1.2.0
  - files_external
  - files_pdfviewer: 1.2.1
  - files_sharing: 1.16.2
  - firstrunwizard: 2.1
  - nextcloud_announcements: 1.10.0
  - password_policy: 1.2.2
  - privacy: 1.0.0
  - recommendations: 0.4.0
  - related_resources: 1.0.3
  - serverinfo: 1.5.0
  - sharebymail: 1.2.0
  - spreed: 15.0.2
  - support: 1.0.0
  - suspicious_login
  - systemtags: 1.2.0
  - text: 1.1.0
  - twofactor_totp
  - user_ldap
  - user_status: 1.0.0
  - weather_status: 1.0.0
sed -i 's/>= 80200/>= 80300/' /var/www/nextcloud/lib/versioncheck.php

I looped through the whole web interface and all apps and didn't face any Nextcloud or PHP error/warning, not even any deprecation warning so far 👍. Of course CI needs to be migrated before it can be officially supported, but as a workaround and for testing I'll stay with this now. Did anyone of you face any actual issues with PHP 8.2 so far? Will report if I do.

MichaIng avatar Jan 18 '23 18:01 MichaIng

I had to upgrade to 8.2 because debian removed 8.1 packages and I couldn't go back, so this was the emergency solution. Works fine.

imol-ai avatar Feb 02 '23 19:02 imol-ai

I had to upgrade to 8.2 because debian removed 8.1 packages and I couldn't go back, so this was the emergency solution. Works fine.

NC26 Beta 2 has been published yesterday (https://github.com/nextcloud/server/pull/36484) with PHP8.2 support (https://github.com/nextcloud/server/pull/36375)

a-bern avatar Feb 03 '23 16:02 a-bern

for nextcloud 24/25 wrote an easy temporary fix that disables php version checking. everything works stable on nextcloud 24.0.10 and 25.0.4 . just replace versioncheck.php file in /nextcloud/lib/ directory. https://github.com/meizuflym/nextcloudversioncheckfix/releases

meizuflym avatar Mar 07 '23 11:03 meizuflym

I had to upgrade to 8.2 because debian removed 8.1 packages and I couldn't go back, so this was the emergency solution. Works fine.

NC26 Beta 2 has been published yesterday (#36484) with PHP8.2 support (#36375)

part of the software does not work on nextcloud 26 rc1. for example the owncloud music app.

meizuflym avatar Mar 07 '23 11:03 meizuflym

I wouldn't completely remove it. Use scalpel instead of hammer:

sed -i 's/>= 80200/>= 80300/' /var/www/nextcloud/lib/versioncheck.php

MichaIng avatar Mar 07 '23 12:03 MichaIng

I wouldn't completely remove it. Use scalpel instead of hammer:

Well, I actually did it with a margin for the future, for the next versions of php so that there are no questions about what to do when let's say php8.3 comes out. technically this will solve the problem forever.

meizuflym avatar Mar 07 '23 12:03 meizuflym

Well, I actually did it with a margin for the future, for the next versions of php

That is exactly the reason why I'd use the above method. Only because Nextcloud 25 runs with PHP 8.2, doesn't mean it (or even Nextcloud 26) runs with PHP 8.3. That check has some reason, and should be hacked only for a very specific NC+PHP combination, where it is known that it works, especially when posting it online for others to follow.

MichaIng avatar Mar 07 '23 12:03 MichaIng

Well, I actually did it with a margin for the future, for the next versions of php

That is exactly the reason why I'd use the above method. Only because Nextcloud 25 runs with PHP 8.2, doesn't mean it (or even Nextcloud 26) runs with PHP 8.3. That check has some reason, and should be hacked only for a very specific NC+PHP combination, where it is known that it works, especially when posting it online for others to follow.

I have tested nextcloud 24 and nextcloud 25 with php 8.2 and I can say that it will work with 8.3 with 80% probability, because it is just a continuation of php 8.x, it does not have many differences from php 8.1 or 8.2. the difference between php 7.x and php 8.x is much bigger, but it still works. For the most part, they only add new functionality and commands, and do not remove and break old functions. in nextcloud 26, it was not the new version of php that broke compatibility with some of the software, but the developers of nextcloud. I added the ability to work with php 8.2 and higher on nextcloud 24/25, if developers need to cut out part of the functionality for this, I'd rather use this way of working.

meizuflym avatar Mar 07 '23 16:03 meizuflym

I'm not sure what problem you aim to solve by completely removing the PHP version check. The only reason where it can be required, is when you are on Debian Bullseye (PHP 7.4) with Nextcloud 25 and want to upgrade to Debian Bookworm (PHP 8.2) with Nextcloud 26, which isn't possible with either an intermediate PHP version via custom compiling or 3rd party repo, or hacking the PHP version check. The letter is the quicker and possibly cleaner solution, but the goal is to do the change as minimal as possible, only to immediately upgrade Nextcloud (making the patch obsolete), to minimise the risk of unexpected misbehaviour.

I added the ability to work with php 8.2 and higher on nextcloud 24/25, if developers need to cut out part of the functionality for this, I'd rather use this way of working.

Manipulate your own Nextcloud instances and run them with any unsupported PHP version you want, but do not encourage others to do the same. It may or may not work fine in your particular case (did you have a look into your webserver, PHP, database and Nextcloud logs to know whether really everything works so fine?), but this also depends on the used apps and features, and we cannot know for sure how every part of core and apps' code reacts to it. This sets such Nextcloud instances an all data they host at risk.

Every "developer" who needs/wants to bypass the PHP version check knows how to do it and does not need publicly shared patches. Those who think they need them, are more likely unaware of the risks and implications and hence should not use them.

MichaIng avatar Mar 07 '23 16:03 MichaIng

I offer people a working solution. if they want, let them use it. developers do not offer such a solution. this is some variation. By way, nextcloud 26 I also screwed the solution of problems with software compatibility. it turned out to be banal funny, it was necessary to add 1 file to /nextcloud/lib/public/AppFramework/Db/ and it all worked. take the Mapper.php file from the latest nextcloud 25 along the same path, and transfer it to nextcloud 26. all software that requires this file starts working normally.

meizuflym avatar Mar 08 '23 06:03 meizuflym

By way, nextcloud 26 I also screwed the solution of problems with software compatibility. it turned out to be banal funny, it was necessary to add 1 file to /nextcloud/lib/public/AppFramework/Db/ and it all worked. take the Mapper.php file from the latest nextcloud 25 along the same path, and transfer it to nextcloud 26. all software that requires this file starts working normally.

Please just read through #34692 (Changes for developers & admins in NC26). Your mapper issue is explained there (#34490). This framework has been deprecated since version 24 and has now been removed with NC26. You can migrate your non working apps to QBMapper instead of using a file which will not be provided with security fixes in the future and can lead to unexpected behavior.

a-bern avatar Mar 08 '23 10:03 a-bern

By way, nextcloud 26 I also screwed the solution of problems with software compatibility. it turned out to be banal funny, it was necessary to add 1 file to /nextcloud/lib/public/AppFramework/Db/ and it all worked. take the Mapper.php file from the latest nextcloud 25 along the same path, and transfer it to nextcloud 26. all software that requires this file starts working normally.

Please just read through #34692 (Changes for developers & admins in NC26). Your mapper issue is explained there (#34490). This framework has been deprecated since version 24 and has now been removed with NC26. You can migrate your non working apps to QBMapper instead of using a file which will not be provided with security fixes in the future and can lead to unexpected behavior.

I tried to transfer the OwnCloud Music application to QBMapper, it cannot work with it. if it works, don't touch it. Yes, and what prevents me from taking this file not from you, where it is not supported from some kind of fright, but from OwnCloud developers? from their git repo to be exact.

meizuflym avatar Mar 08 '23 12:03 meizuflym

So, I have a bit of a problem here.

nc26 doesn't support PHP 7.4. nc25 doesn't support PHP 8.2. My distro only has 8.2 in its repo for the v8 branch of PHP. No 8.1. So I can't run nc25 with 8.2. But if I fallback to 7.4, nc25 won't let me upgrade to nc26 because it detects PHP 7.4.

I tried the alteration to versioncheck above, just so I could at least get far enough to run the updater, but it throws a preg_match(): Compilation failed error. So it would appear I'm stuck. Any ideas?

Having a situation where there's no legitimate way to upgrade between versions is absolutely astonishing. Fix: "WARNING: We've detected you're currently running PHP 7.4 ― Nextcloud v26 will not work with PHP 7.4. You must have a version of PHP 8 installed in order to conclude this update. Are you sure you wish to continue?", or heck, even just an updater-only URL that can be accessed from nc25 while running PHP >= 8.2.

McCovican avatar Jun 15 '23 17:06 McCovican