Upgrade php7 to php8

Hi everyone, so i need to upgrade one of my servers that is in production hosting a website/forum.
I need to upgrade php7 to php8, im only using the official repos from opensuse Leap 15.4.
doing a zypper se php i see that php8 it’s available but I want to know what it’s the must practical way to do the upgrade.

server it’s running Leap 15.4 Kernel 15.4.21, apache 2.4.51 , php 7 .4.33, mariadb 10.6.12

the end goal here is to do the upgrade of php as seamless as possible since we want to keep the server online as much as possible and avoid possible incompatibilities with apache2

i+ | apache2-mod_php7 | PHP7 module for the Apache 2.x webserver               | package
i+ | php7             | Interpreter for the PHP scripting language version 7   | package
i+ | php7-bz2         | bzip2 codec support for PHP                            | package
i  | php7-cli         | Interpreter for the PHP scripting language version 7   | package
i+ | php7-ctype       | Character class extension for PHP                      | package
i+ | php7-curl        | libcurl integration for PHP                            | package
i+ | php7-dom         | Document Object Model extension for PHP                | package
i+ | php7-exif        | EXIF metadata extensions for PHP                       | package
i+ | php7-ftp         | FTP protocol support for PHP                           | package
i+ | php7-gd          | GD Graphics Library extension for PHP                  | package
i+ | php7-gettext     | Native language support for PHP                        | package
i+ | php7-iconv       | Character set conversion functions for PHP             | package
i+ | php7-json        | JSON (de)serializer functions for PHP                  | package
i+ | php7-mbstring    | Multibyte string functions for PHP                     | package
i+ | php7-mysql       | MySQL database client for PHP                          | package
i+ | php7-openssl     | OpenSSL integration for PHP                            | package
i+ | php7-pdo         | PHP Data Objects extension for PHP                     | package
i+ | php7-phar        | PHP Archive extension for PHP                          | package
i+ | php7-sqlite      | SQLite database client for PHP                         | package
i+ | php7-tokenizer   | Extension module to access Zend Engine's PHP tokenizer | package
i+ | php7-xmlreader   | Streaming XML reader extension for PHP                 | package
i+ | php7-xmlwriter   | Streaming-based XML writer extension for PHP           | package
i+ | php7-zip         | ZIP archive support for PHP                            | package
i+ | php7-zlib        | Zlib compression support for PHP                       | package

--+-----------------------------+---------------------------------------------------------------------------------------------+---------+-----------+--------
1 | OSS                         | OSS                                                                                         | Yes     | (r ) Yes  | No
2 | non-oss                     | non-oss                                                                                     | Yes     | (r ) Yes  | No
3 | packman                     | packman                                                                                     | Yes     | (r ) Yes  | Yes
4 | repo-backports-debug-update | Update repository with updates for openSUSE Leap debuginfo packages from openSUSE Backports | No      | ----      | ----
5 | repo-backports-update       | Update repository of openSUSE Backports                                                     | Yes     | (r ) Yes  | Yes
6 | repo-sle-debug-update       | Update repository with debuginfo for updates from SUSE Linux Enterprise 15                  | No      | ----      | ----
7 | repo-sle-update             | Update repository with updates from SUSE Linux Enterprise 15                                | Yes     | (r ) Yes  | Yes
8 | updt-non-oss                | updt-non-oss                                                                                | Yes     | (r ) Yes  | No

I won’t comment on the PHP version issue, but please when you post output (copy/paste from a terminal emulator) then include two more lines in your copy sweep. That with the prompt and the command before the out put, and the new prompt after the output. Then people know what you did, what you working directory was and which user did it and that it is complete and no snippet.

And about your last listing, when you want to inform others with the list of repositories the system uses, then you failed to do so, because the URLs, that tell us which repos they are, are missing, So better

zypper lr -d

or other options that show the URLs.

1 Like

I can only second Henk’s comments. But only looking at your repo list (even without URLS) tells that you are missing the main update repository (OSS)…

super helpful reply’s :expressionless:

sudo zypper lr -d
[sudo] password for root: 
# | Alias                       | Name                                                                                        | Enabled | GPG Check | Refresh | Priority | Type   | URI                                                               | Service
--+-----------------------------+---------------------------------------------------------------------------------------------+---------+-----------+---------+----------+--------+-------------------------------------------------------------------+--------
1 | OSS                         | OSS                                                                                         | Yes     | (r ) Yes  | No      |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.4/repo/oss/     | 
2 | non-oss                     | non-oss                                                                                     | Yes     | (r ) Yes  | No      |   99     | rpm-md | http://download.opensuse.org/distribution/leap/15.4/repo/non-oss/ | 
3 | packman                     | packman                                                                                     | Yes     | (r ) Yes  | Yes     |   90     | rpm-md | https://ftp.fau.de/packman/suse/openSUSE_Leap_15.4/               | 
4 | repo-backports-debug-update | Update repository with updates for openSUSE Leap debuginfo packages from openSUSE Backports | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/update/leap/15.4/backports_debug/    | 
5 | repo-backports-update       | Update repository of openSUSE Backports                                                     | Yes     | (r ) Yes  | Yes     |   99     | rpm-md | http://download.opensuse.org/update/leap/15.4/backports/          | 
6 | repo-sle-debug-update       | Update repository with debuginfo for updates from SUSE Linux Enterprise 15                  | No      | ----      | ----    |   99     | NONE   | http://download.opensuse.org/debug/update/leap/15.4/sle/          | 
7 | 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/                | 
8 | updt-non-oss                | updt-non-oss                                                                                | Yes     | (r ) Yes  | No      |   99     | rpm-md | http://download.opensuse.org/update/leap/15.4/non-oss/            | 

ultimaweb@ns516279:~> sudo zypper se -i php7
Loading repository data...
Reading installed packages...

S  | Name             | Summary                                                | Type
---+------------------+--------------------------------------------------------+--------
i+ | apache2-mod_php7 | PHP7 module for the Apache 2.x webserver               | package
i+ | php7             | Interpreter for the PHP scripting language version 7   | package
i+ | php7-bz2         | bzip2 codec support for PHP                            | package
i  | php7-cli         | Interpreter for the PHP scripting language version 7   | package
i+ | php7-ctype       | Character class extension for PHP                      | package
i+ | php7-curl        | libcurl integration for PHP                            | package
i+ | php7-dom         | Document Object Model extension for PHP                | package
i+ | php7-exif        | EXIF metadata extensions for PHP                       | package
i+ | php7-ftp         | FTP protocol support for PHP                           | package
i+ | php7-gd          | GD Graphics Library extension for PHP                  | package
i+ | php7-gettext     | Native language support for PHP                        | package
i+ | php7-iconv       | Character set conversion functions for PHP             | package
i+ | php7-json        | JSON (de)serializer functions for PHP                  | package
i+ | php7-mbstring    | Multibyte string functions for PHP                     | package
i+ | php7-mysql       | MySQL database client for PHP                          | package
i+ | php7-openssl     | OpenSSL integration for PHP                            | package
i+ | php7-pdo         | PHP Data Objects extension for PHP                     | package
i+ | php7-phar        | PHP Archive extension for PHP                          | package
i+ | php7-sqlite      | SQLite database client for PHP                         | package
i+ | php7-tokenizer   | Extension module to access Zend Engine's PHP tokenizer | package
i+ | php7-xmlreader   | Streaming XML reader extension for PHP                 | package
i+ | php7-xmlwriter   | Streaming-based XML writer extension for PHP           | package
i+ | php7-zip         | ZIP archive support for PHP                            | package
i+ | php7-zlib        | Zlib compression support for PHP                       | package

    Note: For an extended search including not yet activated remote resources please use 'zypper
    search-packages'.

zypper se php8
Repository 'packman' is out-of-date. You can run 'zypper refresh' as root to update it.
Repository 'Update repository of openSUSE Backports' is out-of-date. You can run 'zypper refresh' as root to update it.
Repository 'Update repository with updates from SUSE Linux Enterprise 15' is out-of-date. You can run 'zypper refresh' as root to update it.
Loading repository data...
Reading installed packages...

S | Name             | Summary                                                   | Type
--+------------------+-----------------------------------------------------------+-----------
  | apache2-mod_php8 | PHP8 module for the Apache 2.x webserver                  | package
  | apache2-mod_php8 | PHP8 module for the Apache 2.x webserver                  | srcpackage
  | php8             | Interpreter for the PHP scripting language version 8      | package
  | php8             | Interpreter for the PHP scripting language version 8      | srcpackage
  | php8-APCu        | APCu - APC User Cache                                     | package
  | php8-APCu        | APCu - APC User Cache                                     | srcpackage
  | php8-bcmath      | "Binary Calculator" extension for PHP                     | package
  | php8-bz2         | bzip2 codec support for PHP                               | package
  | php8-calendar    | PHP8 Extension Module                                     | package
  | php8-cli         | Interpreter for the PHP scripting language version 8      | package
  | php8-ctype       | Character class extension for PHP                         | package
  | php8-curl        | libcurl integration for PHP                               | package
  | php8-dba         | Database abstraction layer for PHP                        | package
  | php8-devel       | PHP8 development files for C/C++ extensions               | package
  | php8-dom         | Document Object Model extension for PHP                   | package
  | php8-embed       | Embedded SAPI Library                                     | package
  | php8-embed       | Embedded SAPI Library                                     | srcpackage
  | php8-enchant     | Spell checking extension for PHP                          | package
  | php8-exif        | EXIF metadata extensions for PHP                          | package
  | php8-fastcgi     | FastCGI PHP8 Module                                       | package
  | php8-fastcgi     | FastCGI PHP8 Module                                       | srcpackage
  | php8-fileinfo    | File identification extension for PHP                     | package
  | php8-fpm         | FastCGI Process Manager PHP8 Module                       | package
  | php8-fpm         | FastCGI Process Manager PHP8 Module                       | srcpackage
  | php8-ftp         | FTP protocol support for PHP                              | package
  | php8-gd          | GD Graphics Library extension for PHP                     | package
  | php8-gettext     | Native language support for PHP                           | package
  | php8-gmp         | Bignum extension for PHP                                  | package
  | php8-iconv       | Character set conversion functions for PHP                | package
  | php8-imagick     | Wrapper to the ImageMagick library                        | package
  | php8-imagick     | Wrapper to the ImageMagick library                        | srcpackage
  | php8-intl        | ICU integration for PHP                                   | package
  | php8-ldap        | LDAP protocol support for PHP                             | package
  | php8-mbstring    | Multibyte string functions for PHP                        | package
  | php8-mysql       | MySQL database client for PHP                             | package
  | php8-odbc        | ODBC extension for PHP                                    | package
  | php8-opcache     | Opcode cache extension for PHP                            | package
  | php8-openssl     | OpenSSL integration for PHP                               | package
  | php8-pcntl       | Process Control extension for PHP                         | package
  | php8-pdo         | PHP Data Objects extension for PHP                        | package
  | php8-pear        | PHP Extension and Application Repository                  | package
  | php8-pear        | PHP Extension and Application Repository                  | srcpackage
  | php8-pecl        | PHP Extension Community Library                           | package
  | php8-pgsql       | PostgreSQL database client for PHP                        | package
  | php8-phar        | PHP Archive extension for PHP                             | package
  | php8-phpunit     | Testing framework for PHP                                 | package
  | php8-phpunit     | Testing framework for PHP                                 | srcpackage
  | php8-posix       | POSIX functions for PHP                                   | package
  | php8-readline    | PHP8 readline extension                                   | package
  | php8-redis       | API for communicating with Redis servers                  | package
  | php8-redis       | API for communicating with Redis servers                  | srcpackage
  | php8-shmop       | Alternate, low-level shared memory implementation for PHP | package
  | php8-snmp        | SNMP extension for PHP                                    | package
  | php8-soap        | SOAP/WSDL extension module for PHP                        | package
  | php8-sockets     | Berkeley sockets API for PHP                              | package
  | php8-sodium      | Cryptographic Extension Based on Libsodium                | package
  | php8-sqlite      | SQLite database client for PHP                            | package
  | php8-ssh2        | PHP bindings for the libssh2 library                      | package
  | php8-ssh2        | PHP bindings for the libssh2 library                      | srcpackage
  | php8-sysvmsg     | SysV Message Queue support for PHP                        | package
  | php8-sysvsem     | SysV Semaphore support for PHP                            | package
  | php8-sysvshm     | SysV Shared Memory support for PHP                        | package
  | php8-test        | Interpreter for the PHP scripting language version 8      | package
  | php8-test        | Interpreter for the PHP scripting language version 8      | srcpackage
  | php8-tidy        | PHP8 binding for the Tidy HTML cleaner                    | package
  | php8-tokenizer   | Extension module to access Zend Engine's PHP tokenizer    | package
  | php8-xdebug      | Extended PHP debugger                                     | package
  | php8-xdebug      | Extended PHP debugger                                     | srcpackage
  | php8-xmlreader   | Streaming XML reader extension for PHP                    | package
  | php8-xmlwriter   | Streaming-based XML writer extension for PHP              | package
  | php8-xsl         | PHP8 Extension Module                                     | package
  | php8-zip         | ZIP archive support for PHP                               | package
  | php8-zlib        | Zlib compression support for PHP                          | package

    Note: For an extended search including not yet activated remote resources please use 'zypper
    search-packages'.

If you migrate a production server then the most important thing to do before you move from php7 to php8 is to make sure that all your current php code will execute correctly under php8. Once you have done that you can install php8 on your server.

I moved my openSUSE Tumbleweed installation from php7 to php8 some months ago. Here is how I proceeded:

  1. take a list of all currently installed php7packages
  2. install php8 (this should remove php7)
  3. install all php8 modules needed (see list of php7 modules)
  4. make sure apache2-mod_php8 is installed
  5. check (and if necessary adjust) /etc/sysconfig/apache2
  6. reboot system

I am wondering why refresh is off for

http://download.opensuse.org/update/leap/15.4/non-oss/

And where is

http://download.opensuse.org/update/leap/15.4/oss