Warning about deprecated PHP

Since upgrading to NC30 a warning is displayed, saying: “You are currently running PHP 8.1.30. PHP 8.1 is now deprecated in Nextcloud 30.”

I’ve upgraded PHP using ernolf’s script (Php-updater - a script to upgrade php in a safe way) and that seemed to work fine, with the CLI now reporting:

PHP 8.3.12 (cli) (built: Sep 27 2024 03:53:05) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.12, Copyright (c) Zend Technologies
with Zend OPcache v8.3.12, Copyright (c), by Zend Technologies

when using php -v

Nextcloud is still showing the same warning tho’. So, where does Nextcloud look to see which version of PHP is in use?

did you run

php-updater --switch-version

or only the upgrade?


ernolf

I ran both, first upgrade then --switch-version

samps

Why don’t you give more information?

You should show the output of

php-updater --list-installed

Did you restart the webserver and or the php-fpm (if in use)?


ernolf

php-updater --list-installed tells me that I have two SAPIs installed, nginx and apache2, and suggests that I un-install the one I’m not using, namely apache2.

Trying sudo apt remove apache2 results in a message saying apache2 is not installed, then exits…

Yes, I restarted the webserver (sudo systemctl restart nginx).

I noticed that php-updater --list-installed had an entry saying:

SAPI php8.1-fpm 8.1.30-1+ubuntu22.04.1+deb.sury.org+1 im
\listening on unix socket /run/php/php8.1-fpm.sock <<NOT CONNECTED

and a similar entry for PHP8.3

SAPI php8.3-fpm 8.3.12-1+ubuntu22.04.1+deb.sury.org+1 im
\listening on unix socket /run/php/php8.3-fpm.sock <<NOT CONNECTED

I just don’t know what to do about it…

Did you run

php-updater 8.1 8.3

and ported all settings from 8.1 to 8.3

and did you do the last step from

php-updater --switch-version

where it edits the nginx config data?

What is the output of

sudo systemctl --no-pager list-unit-files apache2*

How and especialy why did you install the libapache2-mod-php module, if you have no apache2 webserver installed?


ernolf

Yes. I reached the end of the script pressing only the ‘continue’ option, but I didn’t see any information saying that it was configuring nginx, just a suggestion to remove apache2. Do you think that, since I can’t just uninstall apche2, that disabling the apache modules might work?

samps@xps:~$ sudo systemctl --no-pager list-unit-files apache2*
UNIT FILE STATE VENDOR PRESET
apache2.service masked enabled

1 unit files listed.

I don’t actually recall installing the libapache2-mod-php module, or Apache… This server was set up when Jammy was only young and it will eventually be replaced. I just wanted to get it to an error-free state before I attempt a dist-upgrade to see if everything is compatible with the current LTS Ubuntu

samps

Good feedback!
I will fix that in future versions.

Could you try to remove the masked unit file with

sudo systemctl unmask apache2

and if you then still can see any unit file, run

sudo apt-get purge apache2*

And then you should run

sudo apt-get purge 'libapache2-mod-php*'

ernolf

Lovely!

That got rid of the message about removing either SAPI when running ‘php-updater --switch-version’

samps

Doing ‘php-updater php8.1 php8.3’, accepting all defaults…

…followed by 'php-updater --switch-version.

No errors or warnings whatsoever

You must edit the file

/etc/nginx/sites-enabled/default

… if you have

There you must change 8.1 into 8.3 in the socket it listens to.

I will fix that script part tomorow so that it takes your and similar use cases into account.
I am in Germany, here is the midle of the night.

Thank you very much for feedback!


ernolf

1 Like

On my Nextcloud setup it’s:

/etc/nginx/conf.d/nextcloud.conf but, yeah, it worked!

Thank you SO much for your help!! I really appreciate it.

3 Likes

@samps
Even if your problem is solved. It would be interesting to know which operating system (e.g. Ubuntu) and which operating system version (e.g. 24.04 LTS) you are using. It looks like you added the PHP sources manually. This is often not necessary. Have you also uninstalled the old PHP version or do you still need it?

@devnull
You’re right. I didn’t leave much info about my setup.

My Nextcloud installation is running on Ubuntu 22.04LTS, upgraded from a 20.04 version where Nextcloud was originally installed, so quite a few versions of NC has been through, each probably leaving little marks behind. Anyway, I can no longer remember when or how PHP entered my setup. It’s sorta like “it’s always been there” and I gues that the last time it was upgraded was during the ‘dist-upgrade’ to Ubu22.04LTS.
I’ve manually removed a 7.x version from my setup a few years ago but I still have PHP8.1, 8.2 and 8.3 (current active version), as well as a PHP8.4, which I haven’t yet activated because it’s not supported by NC30. I doubt that I’ll be needing the 8.1 and 8.2 versions for anything but I’m affraid of jinxing things if I remove them…

samps

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.