NextCloud does not use the new version of PHP 8.2

My characteristics:

  1. I connect the repository and install PHP
apt install software-properties-common
add-apt-repository ppa:ondrej/php
apt update
wget -P /usr/local/bin https://global-social.net/apps/raw/s/php-updater
chmod +x /usr/local/bin/php-updater
php-updater

To the question: What do you want to do with the modified php.ini configuration file?
I choose everywhere: save the currently installed local version
I also agree “Y” everywhere

  1. I switch php versions by selecting manual instead of auto to 8.2 and specifying its serial number.
    for linkgroup in $(ls /var/lib/dpkg/alternatives/ | grep -E "ph(ar|p)"); do sudo update-alternatives --config $linkgroup; done

  2. Deactivate php7.4-fpm and activate php8.2-fpm

a2disconf php7.4-fpm
a2enconf php8.2-fpm
systemctl reload apache2
  1. Checking the PHP version
    of php -v
    Receive:
    PHP 8.2.8 (cli)

  2. Editing the Apache configuration.
    vim /etc/apache2/sites-enabled/nextcloud_http_domain_self_signed.conf
    Changing the line:
    SetHandler “proxy:unix:/run/php/php7.4-fpm.nextcloud.sock|fcgi://localhost”
    Per line:
    SetHandler “proxy:unix:/run/php/php8.2-fpm.sock|fcgi://localhost”
    Save it.

  3. Restarting

systemctl services restart php8.2-fpm
systemctl reload apache2

I’m looking to see if PHP has been updated on the site https://<my_cloud_name>/settings/admin/serverinfo
And I see: PHP 7.4.33

If I run:
systemctl stop php7.4-fpm
, I get a 503 error.

If we compare the modules:

sudo dpkg -l |grep php7.4
sudo dpkg -l |grep php8.2

, then we see that php8.2 lacks the php7.4-json module, it is simply not in the repository.

Output service php8.2-fpm status:

php8.2-fpm.service - The PHP 8.2 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php8.2-fpm.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2023-08-07 15:24:17 +05; 23min ago
       Docs: man:php-fpm8.2(8)
    Process: 72733 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/8.2/fpm/pool.d/www.conf 82 (code=exited, status=0/SUCCESS)
   Main PID: 72730 (php-fpm8.2)
     Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
      Tasks: 3 (limit: 629145)
     Memory: 13.9M
        CPU: 139ms
     CGroup: /system.slice/php8.2-fpm.service
             |-72730 php-fpm: master process (/etc/php/8.2/fpm/php-fpm.conf)
             |-72731 php-fpm: pool www
             `-72732 php-fpm: pool www
Aug 07 15:24:17 cloud systemd[1]: Starting The PHP 8.2 FastCGI Process Manager...
Aug 07 15:24:17 cloud php-fpm8.2[72730]: [07-Aug-2023 15:24:17] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library 'rar.so' (tried: /usr/lib/php/20220829/rar.so (/usr/lib/php/20220829/rar.so: cannot open >
Aug 07 15:24:17 cloud systemd[1]: Started The PHP 8.2 FastCGI Process Manager.

Output service php7.4-fpm status:

php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
     Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2023-08-07 15:27:44 +05; 4min 3s ago
       Docs: man:php-fpm7.4(8)
    Process: 73869 ExecStartPost=/usr/lib/php/php-fpm-socket-helper install /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=exited, status=0/SUCCESS)
   Main PID: 73863 (php-fpm7.4)
     Status: "Processes active: 0, idle: 5, Requests: 81, slow: 0, Traffic: 0.6req/sec"
      Tasks: 6 (limit: 629145)
     Memory: 69.7M
        CPU: 3.675s
     CGroup: /system.slice/php7.4-fpm.service
             |-73863 php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)
             |-73864 php-fpm: pool Nextcloud
             |-73865 php-fpm: pool Nextcloud
             |-73866 php-fpm: pool Nextcloud
             |-73867 php-fpm: pool www
             `-73868 php-fpm: pool www
Aug 07 15:27:44 cloud systemd[1]: Starting The PHP 7.4 FastCGI Process Manager...
Aug 07 15:27:44 cloud systemd[1]: Started The PHP 7.4 FastCGI Process Manager.

Output ps -ef| fgrep -i php-fpm:

root       72730       1  0 15:24 ?        00:00:00 **php-fpm: master process (/etc/php/8.2/fpm/php-fpm.conf)**
www-data   72731   72730  0 15:24 ?        00:00:00 php-fpm: pool www
www-data   72732   72730  0 15:24 ?        00:00:00 php-fpm: pool www
root       73863       1  0 15:27 ?        00:00:00 **php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)**
www-data   73864   73863  0 15:27 ?        00:00:02 php-fpm: pool Nextcloud
www-data   73865   73863  0 15:27 ?        00:00:02 php-fpm: pool Nextcloud
www-data   73866   73863  0 15:27 ?        00:00:02 php-fpm: pool Nextcloud
www-data   73867   73863  0 15:27 ?        00:00:00 php-fpm: pool www
www-data   73868   73863  0 15:27 ?        00:00:00 php-fpm: pool www
root       74250     815  0 15:36 pts/1    00:00:00 grep -F --color=auto -i php-fpm

Output ls -l “/etc/apache2/conf-enabled/”:

total 3
lrwxrwxrwx 1 root root 30 Nov 23  2021 charset.conf -> ../conf-available/charset.conf
lrwxrwxrwx 1 root root 44 Nov 23  2021 localized-error-pages.conf -> ../conf-available/localized-error-pages.conf
lrwxrwxrwx 1 root root 46 Nov 23  2021 other-vhosts-access-log.conf -> ../conf-available/other-vhosts-access-log.conf
lrwxrwxrwx 1 root root 33 Aug  7 15:20 php8.2-fpm.conf -> ../conf-available/php8.2-fpm.conf
lrwxrwxrwx 1 root root 31 Nov 23  2021 security.conf -> ../conf-available/security.conf
lrwxrwxrwx 1 root root 36 Nov 23  2021 serve-cgi-bin.conf -> ../conf-available/serve-cgi-bin.conf

Output ls -l “/etc/apache2/mods-enabled/”:

total 20
lrwxrwxrwx 1 root root 36 Nov 23  2021 access_compat.load -> ../mods-available/access_compat.load
lrwxrwxrwx 1 root root 28 Nov 23  2021 alias.conf -> ../mods-available/alias.conf
lrwxrwxrwx 1 root root 28 Nov 23  2021 alias.load -> ../mods-available/alias.load
lrwxrwxrwx 1 root root 33 Nov 23  2021 auth_basic.load -> ../mods-available/auth_basic.load
lrwxrwxrwx 1 root root 33 Nov 23  2021 authn_core.load -> ../mods-available/authn_core.load
lrwxrwxrwx 1 root root 33 Nov 23  2021 authn_file.load -> ../mods-available/authn_file.load
lrwxrwxrwx 1 root root 33 Nov 23  2021 authz_core.load -> ../mods-available/authz_core.load
lrwxrwxrwx 1 root root 33 Nov 23  2021 authz_host.load -> ../mods-available/authz_host.load
lrwxrwxrwx 1 root root 33 Nov 23  2021 authz_user.load -> ../mods-available/authz_user.load
lrwxrwxrwx 1 root root 32 Nov 23  2021 autoindex.conf -> ../mods-available/autoindex.conf
lrwxrwxrwx 1 root root 32 Nov 23  2021 autoindex.load -> ../mods-available/autoindex.load
lrwxrwxrwx 1 root root 30 Nov 23  2021 deflate.conf -> ../mods-available/deflate.conf
lrwxrwxrwx 1 root root 30 Nov 23  2021 deflate.load -> ../mods-available/deflate.load
lrwxrwxrwx 1 root root 26 Nov 23  2021 dir.conf -> ../mods-available/dir.conf
lrwxrwxrwx 1 root root 26 Nov 23  2021 dir.load -> ../mods-available/dir.load
lrwxrwxrwx 1 root root 26 Nov 23  2021 env.load -> ../mods-available/env.load
lrwxrwxrwx 1 root root 30 Nov 23  2021 evasive.conf -> ../mods-available/evasive.conf
lrwxrwxrwx 1 root root 30 Nov 23  2021 evasive.load -> ../mods-available/evasive.load
lrwxrwxrwx 1 root root 29 Nov 23  2021 filter.load -> ../mods-available/filter.load
lrwxrwxrwx 1 root root 30 Nov 23  2021 headers.load -> ../mods-available/headers.load
lrwxrwxrwx 1 root root 28 Nov 23  2021 http2.conf -> ../mods-available/http2.conf
lrwxrwxrwx 1 root root 28 Nov 23  2021 http2.load -> ../mods-available/http2.load
lrwxrwxrwx 1 root root 27 Nov 23  2021 mime.conf -> ../mods-available/mime.conf
lrwxrwxrwx 1 root root 27 Nov 23  2021 mime.load -> ../mods-available/mime.load
lrwxrwxrwx 1 root root 32 Nov 23  2021 mpm_event.conf -> ../mods-available/mpm_event.conf
lrwxrwxrwx 1 root root 32 Nov 23  2021 mpm_event.load -> ../mods-available/mpm_event.load
lrwxrwxrwx 1 root root 34 Nov 23  2021 negotiation.conf -> ../mods-available/negotiation.conf
lrwxrwxrwx 1 root root 34 Nov 23  2021 negotiation.load -> ../mods-available/negotiation.load
lrwxrwxrwx 1 root root 28 Nov 23  2021 proxy.conf -> ../mods-available/proxy.conf
lrwxrwxrwx 1 root root 28 Nov 23  2021 proxy.load -> ../mods-available/proxy.load
lrwxrwxrwx 1 root root 33 Nov 23  2021 proxy_fcgi.load -> ../mods-available/proxy_fcgi.load
lrwxrwxrwx 1 root root 33 Nov 23  2021 reqtimeout.conf -> ../mods-available/reqtimeout.conf
lrwxrwxrwx 1 root root 33 Nov 23  2021 reqtimeout.load -> ../mods-available/reqtimeout.load
lrwxrwxrwx 1 root root 30 Nov 23  2021 rewrite.load -> ../mods-available/rewrite.load
lrwxrwxrwx 1 root root 31 Nov 23  2021 setenvif.conf -> ../mods-available/setenvif.conf
lrwxrwxrwx 1 root root 31 Nov 23  2021 setenvif.load -> ../mods-available/setenvif.load
lrwxrwxrwx 1 root root 36 Nov 23  2021 socache_shmcb.load -> ../mods-available/socache_shmcb.load
lrwxrwxrwx 1 root root 26 Nov 23  2021 ssl.conf -> ../mods-available/ssl.conf
lrwxrwxrwx 1 root root 26 Nov 23  2021 ssl.load -> ../mods-available/ssl.load

So my NextCloud is still using 7.4 and if I delete all files:
apt-get remove --purge php7.4*
then the server crashes.

Please help me update PHP correctly!

You posteted in the section “appliances-docker-snappy-vm”

Update procedure for such appliances is different.

I have a container created in proxmox using an LXC container, my “nextcloud” is deployed on it
Is there a separate update method for my case?

Normally yes.
But I’m not familiar with it because I avoid such container solutions like the devil avoids holy water.
I’m an old-fashioned Linuxian :wink:

So of course there is nothing to be said against it, but then of course you should also deal with it in detail and not think that it is somehow easier. On the contrary, there are more and more layers being packed around the applications. Very suitable for lovers of complex solutions.

much luck!

When executing the command:
sudo -u www-data php -f /var/www/next cloud/cc app:update --all

I get an error:
This version of Next cloud is incompatible with PHP>=8.2.<br/>You currently have version 8.2.8 installed

Naturally. Your CLI PHP is not what your server is working with. It uses either an Apache2 module or php-fpm. As an admin, you need to know that.
Then, as I said, I don’t know what your container looks like, whether it brings its own php etc.
So get smart about your system. Nobody can do that but you.

I realized that the previous admin initially chose not the easiest way to install NextCloud.
Can you tell me a way to painlessly transfer my NextCloud from a container to a regular virtual machine?

I just killed my Nextcloud server that was running on Dreamhost shared hosting and php 7.4. After upgrading to 8.2 and then down to 8.0 now it’s broken quite and the Dreamhost gadget panel does not seem to let me downgrade back to php 7.4 without paying extra (smart business move, maybe I should just pay for the support?).

@Tom_Atkinson
Please open an own thread. Which Nextcloud version do you use?

Requirements. Check the PHP version:
Nextcloud 28
Nextcloud 27
Nextcloud 26
Nextcloud 25

Why isn’t 8.3 ‘recommended’ for Nextcloud 28.? Assuming it runs without problem (does it?) then surely the later php version would be recommended. If it doesn’t run Ok then 8.3 shouldn’t be an alternative for Nextcloud 28.

Maybe because the actual default PHP version e.g. in Debian Bookworm (stable) is PHP 8.2. You can use the default PHP from your linux distribution.

PHP 8.3 is the newest php-Version: PHP: Supported Versions

Nextcloud 28 supports php8.3. Unfortunately, a lot of apps don’t yet. The result would be that these apps will not be updated or offered for installation unless they have also been updated to php8.3. For that reason, it is recommended to stick with php8.2 for now. However, if you know your way around, you can install php8.3

With the commandline app store nc-apps it is possible to run Nextcloud under php8.3 and still browse all available apps, even when not compatile with php8.3 and bring the php8.2 apps up to date if a php8.2 minimal-installation beside your php8.3 is present.


Much and good luck,
ernolf