Nextcloud 27 list php 8.0 where 8.2 is installed (solved)

Hello,

I installed Nextcloud 27 on my server. In the Security & setup warnings

the following warnings appear.

When I check the php-version with php -v on the server. I get the following response

PHP 8.2.8 (cli) (built: Jul 8 2023 07:10:21) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.8, Copyright (c) Zend Technologies
with Zend OPcache v8.2.8, Copyright (c), by Zend Technologies

I checked several config and ini files but I can not find the failure.

The server is running under β€œUbuntu 22.04.2 LTS (GNU/Linux 5.15.107-2-pve x86_64)” in an Proxmox environment .

Does someone of you have an idea?

Thank you in advance
Ulrich

When you check with php -v in linux command line, it reports PHP version configured for the command line , which can differ from the one that is used by apache/php-fpm used for serving the web content.

The easist to test where your config files point to for the apache/php-fpm config is to create a simple info.php file in your web directory with your Nextcloud installation, the content of the info.php file is the simple one line : <? phpinfo(); ?>
Then go to your browsers, open this info.php file and check the sections for the loaded configuration file / other ini files as per the example screenshot:

Then you need to go and fix your PHP config, so that the apache uses the correct one.

1 Like

If you are using apache2 (you did not provide that information!)

Invoke these commands:

apachectl -tD DUMP_INCLUDES | sed -n '/php.*conf/ s#.*/\([^/]*\)\.conf#\1#p'
dpkg -l | awk '/^ii.*php/ {print $2}'

and:

update-alternatives --get-selections | grep -E "ph(ar|p)"

and if that does not help you, post the echoes here.

Much luck

1 Like

Hello Leo,

thank you for your help. It brought me to the right solution. Some additional information how I solved it.

  1. I create the info.php file as followed:

sudo nano /var/www/html/info.php

The following 3 lines in the file

<?php
    phpinfo();
 ?>

In the web browser I called "ip-address/info.php

Here I got all inforation on the php

I disabled the php8.0 by

sudo a2dismod php8.0

I disabled the php8.2 by

sudo a2dismod php8.2

restarted the apache2

systemctl restart apache2

enabled the php8.2

sudo a2enmod php8.2

restarted the apache2 again

systemctl restart apache2

Done

Thank you again for your support.
Ulrich

2 Likes

Hello ernolf,

thanks for your help.

I could solve the problem in the meantime. (details see below)

Best regards
Ulrich

1 Like

I use nextcloud, pihole and zabbix system on Debian 11 (AMD64), and I had to do this additional step to the above mentioned steps:

sudo a2enconf php8.2-fpm

before I installed it via sudo apt php-fpm

then systemctl restart apache2

This solved the php8.2 change for me.

Hi ernolf, do you know the same procedure but for Centos with yum?

yum (which is a link to dnf) is almost the same as apt/apt-get in terms of usage. The options are very similar:

sudo apt(-get) update

corresponds to

sudo yum(/dnf) makecache

apt(-get) upgrade

corresponds to

yum(/dnf) upgrade

apt(-get) install $package(s)

corresponds to

yum(/dnf) install $package(s)

Much luck,
ernolf

thanks, ernolf, but what about a2dismod and a2enmod ? These are the hard parts for me

That are tools to enable and disable modules.
They create symlinks from available to used modules.

In Centos (Red hat based OSes) you mostly have to create the symlinks this way:

for a2enmod (which stand for apache2 enable module) you have to run

sudo ln -s /etc/httpd/modules-available/<modulename>.conf /etc/httpd/conf.modules.d/

and for a2dismod (which stand for apache2 disable module) you have to run

sudo rm /etc/httpd/conf.modules.d/<modulename>.conf

Note that <modulename> should be replaced with the actual name of the Apache module.

It is important to note that this procedure may change depending on the Apache version and the specific configuration on your system. It’s always a good idea to consult the documentation for your specific Apache version and your Linux distribution.

Much luck,
ernolf