Need help updating from PHP 7.4 to PHP 8.1

Hi, trying to keep it short:

I have three issues in step #4 below:

This is my update approach:

  1. get a list of all installed PHP7 packages
  2. remove them
  3. find best suited official repo for update to PHP8.1 and enable it
  4. install all the packages

  1. create a list of all installed PHP7 packages:

rpm -qa | grep php7 | awk -F- -vOFS=- ‘{print $1,$2}’ | sort | tr ‘\n’ ’ ’ | tee php7.pkgs
php7-7.4.33 php7-bz2 php7-cli php7-ctype php7-curl php7-dom php7-exif php7-fileinfo php7-fpm php7-gd php7-gettext php7-iconv php7-imagick php7-intl php7-json php7-mbstring php7-mysql php7-opcache php7-openssl php7-pdo php7-phar php7-redis php7-sodium php7-sqlite php7-tokenizer php7-xmlreader php7-xmlwriter php7-zip php7-zlib

  1. remove them

zypper rm --clean-deps php7 php7-bz2 php7-cli php7-ctype php7-curl php7-dom php7-exif php7-fileinfo php7-fpm php7-gd php7-gettext php7-iconv php7-imagick php7-intl php7-json php7-mbstring php7-mysql php7-opcache php7-openssl php7-pdo php7-phar php7-redis php7-sodium php7-sqlite php7-tokenizer php7-xmlreader php7-xmlwriter php7-zip php7-zlib

  1. find best suited official repo for update to PHP8.1 and enable it

opi php8

8.1.17 is the latest 8.1 release, available in repo devel:languages:php

opi output:
"You have selected binary package: devel:languages:php ? | 8.1.17 | x86_64
Adding repo ‘devel:languages:php’

Import package singing key ‘devel\x3alanguages\x3aphp OBS Project <devel\x3alanguages\x3aphp@build.opensuse.org’ (Y/n)"

y

  1. install all the packages

zypper in php8 php8-bz2 php8-cli php8-ctype php8-curl php8-dom php8-exif php8-fileinfo php8-fpm php8-gd php8-gettext php8-iconv php8-imagick php8-intl php8-json php8-mbstring php8-mysql php8-opcache php8-openssl php8-pdo php8-phar php8-redis php8-sodium php8-sqlite php8-tokenizer php8-xmlreader php8-xmlwriter php8-zip php8-zlib

Output:

“Loading repository data…
Reading installed packages…
Package ‘php8-json’ not found.
Resolving package dependencies…
2 Problems:
Problem: the to be installed php8-imagick-3.7.0-lp154.16.1.x86_64 requires ‘php(api) = 20200930’, but this requirement cannot be provided
Problem: the to be installed php8-redis-5.3.7-bp154.2.1.x86_64 requires ‘php(api) = 20200930’, but this requirement cannot be provided”

So, there seem to be three issues:

  1. Where is php8-json?
  2. Where can I get a properly adapted php8-imagick package, using proper api version?
  3. Where can I get a properly adapted php8-redis package, using proper api version?

Eventually someone else has already gone through this and could provide some help here which would be highly appreciated.

Regards

There is nothing “official” here. It is development repository used by developers. The packages become “official” when they are submitted to Leap or Tumbleweed. Besides, this project only contains php itself, not various modules.

php8-redis comes from standard Leap 15.4 repository and is built against php 8.0. Your command line does not specify repositories so zypper will pick the one with the highest versoin. It apparently decides to install php8 from devel:languages:php but php8-redis from standard Leap. Which implies that php8-redis does exist in devel:languages:php or has lower version. As for php8-imagick, we do not know where it comes from.

Show your repostories (zypper lr -d).

This is the list of enabled repositories in short:

zypper lr | awk -F’|’ ‘{gsub(/ /, “”, $0); if($4==“Yes”) print $2}’
devel_languages_php
devel_languages_python_certbot
home_ecsos_server
nginx
openSUSE-Leap-15.4-1
repo-backports-update
repo-non-oss
repo-oss
repo-sle-update
repo-update
repo-update-non-oss

and in long (the -E option exists, but does not filter the disabled repos):

sudo zypper lr -E -e -
[devel_languages_php]
name=devel:languages:php
enabled=1
autorefresh=1
baseurl=https://download.opensuse.org/repositories/devel:/languages:/php/openSUSE_Leap_$releasever/
type=rpm-md
gpgcheck=1
gpgkey=https://download.opensuse.org/repositories/devel:/languages:/php/openSUSE_Leap_$releasever/repodata/repomd.xml.key

[devel_languages_python_certbot]
name=devel:languages:python:certbot
enabled=1
autorefresh=1
baseurl=https://download.opensuse.org/repositories/devel:/languages:/python:/certbot/$releasever/
type=rpm-md
gpgcheck=1
gpgkey=https://download.opensuse.org/repositories/devel:/languages:/python:/certbot/$releasever/repodata/repomd.xml.key

[home_ecsos_server]
name=home:ecsos:server
enabled=1
autorefresh=1
baseurl=https://download.opensuse.org/repositories/home:/ecsos:/server/$releasever/
type=rpm-md
gpgcheck=1
gpgkey=https://download.opensuse.org/repositories/home:/ecsos:/server/$releasever/repodata/repomd.xml.key

[nginx]
enabled=1
autorefresh=1
baseurl=https://download.opensuse.org/repositories/server:/http/15.4/
type=rpm-md
keeppackages=1

[openSUSE-Leap-15.4-1]
name=openSUSE-Leap-15.4-1
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/15.4/repo/oss/
path=/
type=rpm-md
keeppackages=0

[repo-backports-debug-update]
name=Update repository with updates for openSUSE Leap debuginfo packages from openSUSE Backports
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/backports_debug/
keeppackages=0

[repo-backports-update]
name=Update repository of openSUSE Backports
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/backports/
path=/
type=rpm-md
keeppackages=0

[repo-debug]
name=Debug Repository
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/oss/
keeppackages=0

[repo-debug-non-oss]
name=Debug Repository (Non-OSS)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/distribution/leap/$releasever/repo/non-oss/
keeppackages=0

[repo-debug-update]
name=Update Repository (Debug)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/update/leap/$releasever/oss/
keeppackages=0

[repo-debug-update-non-oss]
name=Update Repository (Debug, Non-OSS)
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/update/leap/$releasever/non-oss/
keeppackages=0

[repo-non-oss]
name=Non-OSS Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/non-oss/
path=/
type=rpm-md
keeppackages=0

[repo-oss]
name=Main Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/distribution/leap/$releasever/repo/oss/
path=/
type=rpm-md
keeppackages=0

[repo-sle-debug-update]
name=Update repository with debuginfo for updates from SUSE Linux Enterprise 15
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/debug/update/leap/$releasever/sle/
path=/
keeppackages=0

[repo-sle-update]
name=Update repository with updates from SUSE Linux Enterprise 15
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/sle/
path=/
type=rpm-md
keeppackages=0

[repo-source]
name=Source Repository
enabled=0
autorefresh=1
baseurl=http://download.opensuse.org/source/distribution/leap/$releasever/repo/oss/
keeppackages=0

[repo-update]
name=Main Update Repository
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/oss
path=/
type=rpm-md
keeppackages=0

[repo-update-non-oss]
name=Update Repository (Non-Oss)
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/update/leap/$releasever/non-oss/
path=/
type=rpm-md
keeppackages=0

Most of your repos are invalid as the URL contains $releasever instead of the version number 15.4

This is easy to detect by opening the URLs in a browser…

And this fancy command which you showed is not what was requested:

To show only enabled repos simply use:
zypper lr -dE

And please use the preformatted text icon </> when you post terminal output here…

zypper lr -dE
#  | Alias                          | Name                                                         | Enabled | GPG Check | Refresh | Priority | Type   | URI                                                                                  | Service
---+--------------------------------+--------------------------------------------------------------+---------+-----------+---------+----------+--------+--------------------------------------------------------------------------------------+--------
 1 | devel_languages_php            | devel:languages:php                                          | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/devel:/languages:/php/openSUSE_Leap_15.4/ |
 2 | devel_languages_python_certbot | devel:languages:python:certbot                               | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/devel:/languages:/python:/certbot/15.4/   |
 3 | home_ecsos_server              | home:ecsos:server                                            | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/home:/ecsos:/server/15.4/                 |
 4 | nginx                          | nginx                                                        | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | https://download.opensuse.org/repositories/server:/http/15.4/                        |
 5 | openSUSE-Leap-15.4-1           | openSUSE-Leap-15.4-1                                         | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.4/repo/oss/                        |
 7 | repo-backports-update          | Update repository of openSUSE Backports                      | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.4/backports/                             |
12 | repo-non-oss                   | Non-OSS Repository                                           | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.4/repo/non-oss/                    |
13 | repo-oss                       | Main Repository                                              | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.4/repo/oss/                        |
15 | repo-sle-update                | Update repository with updates from SUSE Linux Enterprise 15 | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.4/sle/                                   |
17 | repo-update                    | Main Update Repository                                       | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.4/oss                                    |
18 | repo-update-non-oss            | Update Repository (Non-Oss)                                  | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.4/non-oss/ 

Stop talking nonsense.

Those URLs are not for your browser, they are for zypper.

I’m so sorry that i hurt your fragile feelings. I was not aware that on Leap zypper lr -e - hurls another URL format than the basic zypper lr -d output

Hope the forum god can forgive me :roll_eyes:

As I already said - this repository provides only php itself, but not any of the additional modules you tried to install. So, you ended up trying to install php 8.1 and a lot of modules built for php 8.0. I have no idea whether this will work (even for modules not explicitly requiring php 8.0). To find out where php8-imagick comes from, use zypper se -s php8-imagick.

You will need to find project that builds those modules for php 8.1 on Leap 15.4. Or more likely build them yourself.

There is no php8-json package, because php8-json is now build in (included) in php8 by default.


# builtin extensions
...
Provides:       php-json = %{version}

and

# json is now integral part of core, cannot be disabled
Obsoletes:      php7-json

For 2 and 3: Update to php 8.0 or build the package for php 8.1.

Oviously my mistake has been to assume that all PHP packages that are available in the current stable version (PHP 7.4) will also be available in the current development version (PHP 8.0.28, 8.1.17 or 8.2.4). In fact this is only the case for PHP 8.0.28. For newer PHP versions, you are on your own.

After making myself somewhat more familiar with compiling and installing PHP packages, I have to admit it is not that hard–which immediately raises the question why those packages are missing in PHP 8.1 and 8.2 devel repos. Is this lazyness? Or a don’t care attitude? Seriously.

It just feels a bit strange to compile your own packages for a production system. Given that OwnCloud requires PHP8 these days and Redis is widely being used as an object cache for WordPress, openSUSE IMO is lagging behind with the PHP 7.4 default.

But I am now where I want to be–on the latest PHP version:

$  php -ver
PHP 8.2.4 (cli) (built: Mar 16 2023 12:00:00) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.4, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.4, Copyright (c), by Zend Technologies
$  php -m | tr '\n' ' '
[PHP Modules] bz2 Core ctype curl date dom exif fileinfo filter gd gettext hash iconv igbinary imagick intl json libxml mbstring msgpack mysqli mysqlnd openssl pcre PDO pdo_mysql pdo_sqlite Phar random redis Reflection session SimpleXML sodium SPL sqlite3 standard tokenizer xml xmlreader xmlwriter Zend OPcache zip zlib  [Zend Modules] Zend OPcache 

Thanks for all your suggestions.

Apparently you are not lazy and you do care so what stops you from maintaining these packages for your PHP versions?

1 Like