NextcloudPi shows wrong PHP version

Support intro

Before clicking submit: Please check if your query is already addressed via the following resources:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 34.0.1
  • Operating system and version (e.g., Ubuntu 24.04):
    • Linux 6.6.63-current-bcm2712 aarch64
  • Web server and version (e.g, Apache 2.4.25):
    • replace me
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • replace me
  • PHP version (e.g, 8.3):
    • 8.3.31
  • Is this the first time you’ve seen this error? (Yes / No):
    • No
  • When did this problem seem to first start?
    • After installation of NCP 1.54.0
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • NCP
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

ncp-dist-upgrade is available but cannot be executed as ncp reports the PHP still to be 8.1 although only 8.3.31 is installed

Steps to replicate it (hint: details matter!):

  1. Log on to ncp via ssh

  2. perform sudo ncp-dist-upgrade

Log entries

Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the Copy raw option from Administration settings->Logging screen or from your

This is what I’d like to know …

Early last year I tried to install ncp on a Pi5 (then latest version: 1.55.0). However the system got stuck while booting in a PHP loop (PHP 8.3). I then installed 1.54.0 (PHP 8.1) which worked fine. I could successfully setup my instance.

I updated ncp to 1.55.0 - but obviously PHP 8.1 did not update to PHP 8.3 as it was supposed to. I then installed PHP 8.3 manually executing php-updater script and removed all remains of PHP 8.1:

I am aware that I made manual changes to the configuration when I executed php-updater and I understand that this can cause problems. My understanding of the issue is that somewhere - maybe in a config file - the previous PHP version 8.1 is still prevalent. My question is simple: Can this be fixed or would you recommend a reinstallation of ncp?

As my instance has been running smoothely all the time (correctly displaying PHP 8.3.31 by the way) I pretty much ignored the issue but now, in the light of the pending dist-upgrade, I’d like to have it fixed one way or the other.

Yes, probably, but may be not by “us”.
The update to ncp 1.58 went without errors?
The error messages running sudo ncp-dist-upgrade maybe helpful.

Hi @piemaker,

That sounds a little strange. :sweat_smile:

Have you also switched the system interpreter to the new PHP version?
sudo update-alternatives --config php
→ Select PHP version 8.3

Have you also enabled the new PHP version on the web server?

sudo a2dismod php8.1-version
sudo a2enmod php8.3-version

These two commands disable the old PHP version in the Apache web server and enable the new PHP version.
This allows Apache to determine which PHP version is actually used when web pages are loaded.

Best regards!

Hi @Forest.328 ,

thanks for reaching out.

I already executed update-alternatives --config php:

I selected 0 for auto mode

The other two commands generate this output:

grafik

Hi @geoW

Yes, all further ncp updates worked fine.

This is what I get when I run ncp-dist-upgrade:

grafik

The webserver displays the latest php version:

Hi @piemaker,

for testing please select the manual mode and try it again. :slight_smile:

tbh, I just try setting up a rpi5 test server, I never succeed in doing a proper dist-upgrade on rpi5, rpi4 went well.

Same result …

What I also had done before I opened this issue here was:

All commands worked fine (using PHP8.3 respectively) but neither of them made any difference. The upper ones were surely useless as I had removed all vestiges of PHP8.1 before. The lines for setting up Apache for PHP8.3 looked promising but had no effect.

I have the same issue. Any updates how to fix it?

What I have found out so far is that the directory /etc/php/8.1/fpm, including the conf.d and pool.d subdirectories, keeps getting recreated.

As far as I can tell, I’ve already removed everything related to PHP 8.1 FPM, and I can’t find any references to it in the Apache configuration or anywhere else that would explain this behavior.

There must still be something on the system that references PHP 8.1 FPM or triggers the recreation of these directories, but I haven’t been able to identify it.

@OlliM14 Thanks for your reply.

  • did you install php8.3 manually using php-updater?
  • do you run ncp on a rpi5, too?
  • if so, did you experience the same thing when setting up ncp 1.54?

I’m asking because if @geoW is right and ncp has issues running fine on a rpi5 it won’t make sense to reinstall a clean version of the latest ncp.

No, I also followed the instructions that geoW shared.

Yes, I’m running NCP on a Raspberry Pi 5, and I currently have version 1.58.0 installed, so I can’t check whether the same issue occurred with 1.54.

I’ll try using the PHP updater and will share the results here once I’ve tested it.

A beautiful solution occurs in similar situation:
Nextcloudpi not working after ncp-dist-upgrade
It is worth a try, it doesn’t hurt.

I did some more digging to find out why “90-ncp.ini” kept being recreated.

The cause was that after upgrading PHP manually, PHP had been upgraded to 8.3, but “php_version” in “/usr/local/etc/ncp.cfg” was still set to “8.1”.

As a result, NextCloudPi kept recreating:

“/etc/php/8.1/fpm/conf.d/90-ncp.ini”

even though PHP 8.1 had already been removed.

Fix: Update “php_version” in “/usr/local/etc/ncp.cfg” to match the installed PHP version (8.3 in my case). After that, “90-ncp.ini” is created in the correct PHP directory.

@piemaker Thanks for the tip about the PHP updater. It made upgrading to PHP 8.5 very easy. However, it seems that it did not update “ncp.cfg”, so the old PHP version remained configured there.

THAT IS IT!!! :folded_hands:

ncp.cfg was not updated to the new php-version, still showed 8.1 - changing this to 8.3 did the trick. Assuming sort of a vestige of an incorrect php-version being prevalent in some config-file was right then.

  • the webserver now displays the correct version:

  • And ncp would finally let me run the update script “ncp-dist-upgrade” which took a hell lot of time to finish.
  • Did a reboot of ncp and now all systems seem to work properly

Thank you so much everyone in this forum. Special thanks to @OlliM14 for digging deeper into the issue.