Change PHP version

SYSTEM INFORMATION
OS type and version Debian 12
Webmin version 2.520
Virtualmin version 7.40.1
Webserver version Brave
Theme version 25.20

I want to change PHP version from 7.4 to 8.4
It works fine for most pages but for some websites it gives an error when you want to change language for example.
Is there something missing in PHP 8.4?

Post the error

1 Like

Some older websites won’t behave with later PHP versions.

I have one that has to stay 7.4 due to an old WP plugin that the client uses.

after a major version change probably quite a lot!
would you go backward to v 5.x

7.4 → 8.4 is quite a change but the errors can usually be fixed very easy unless they are very specialised functions.

sure, if the website owner knows what to do and has the time. but if this is a managed VM with (potentially) many different clients and (different) complex websites it could be time wasted. It is possible to run 7.4 for one VS and 8.4 or the rest.

7.4 is EOL by a long way. I have a lot of websites on 7.4 that need updating, but they will not be stayying on that version.

You have to be specific. You have to look at logs.

There are differences between 7.4 and 8.4, of course there are! That’s a major version change.

If you want a list of all the differences (and there are many), go to the PHP documentation and changelog. But, if you want to fix specific problems your sites are having, you need to look at the errors in the PHP log, and if you don’t know what to do with the information given in the log, you can bring it here or to a PHP forum to talk about it and get solutions.

The main issue when installing a new PHP version like 8.4 over an older one is that the new version usually lacks some of the PHP modules that were installed for the old version, such as 7.4.

You can use the “Webmin / Tools ⇾ PHP Configuration” module and its extension management feature to make sure PHP 8.4 has the same set of extensions as previous 7.4 version.

Thanks Ilia

Missing modules are:
imap
intl
json
zip

Which command will add them to 8.4 version?

@Smedby You can click on the “Manage” button for the PHP 8.4 version in the “Actions” column, then click “PHP Extensions” icon, and add/install PHP extensions one by one at the bottom of the page.

@Jamie, We should accept a space-separated list of PHP extensions to install. Installing them one by one can be annoying.

The button

  • This is confusing. what exactly do you type in here. You need to know the full extensions name.
  • I will never use this. Unless you use the CLI a lot, you will never use this.
  • You would be better off putting a link to the package installer page with pre-done filters
  • When you have to guess the package names why would you not just use the package installer

The Page
This page serves no purpose for me. I will only install the extensions I need and remove them when I do not want or need them any more. If a developer needs to disable a PHP extension he will go into php.ini and comment out the line manually.

My thoughts

This page should be made to install and uninstall PHP extensions, not just enable disable.

The button at the bottom is not of any use. It is just another thing no-one really knows how to use or needs too. :frowning:

You can pull the extensions list repositories using a filter mask php8_ etc.. so an end user can select all of the php extensions in one go and then click install.

Maybe their is a list of PHP extensions that can be used instead of a parsing the repositories.

Maybe keep the enable and disable options for the users that will use it.

I use Windows and GUIs, and I like that :smiley:

It shall probably be this:

sudo apt update (Updating repository to see last version available)
sudo apt install php8.4-imap php8.4-intl php8.4-json php8.4-zip (Add missing Module: php8.4-NameOfTheModule )

Only what is in bold, then restart the whole

It shall be noticed that if you are dev there may be language incompatibilities. What was a warn in a previous version can become an error in the next, breaking everything.

Note: I removed the link Joe is talking after. As he rightly said It could have lead members to a huge mistake

1 Like

Do not follow that guide! It will install mod_php if you’re installing packages for the first time for a specific PHP version. mod_php is dangerous and breaks every other execution mode.

Specifically, you should not install the php8.4 package, and it depends on mod_php. This is very stupid on the part of the Debian/Ubuntu developers, and there’s been a ticket about it in their issue tracker for years, maybe a decade. But, that’s how it is.

I’m begging y’all: Do not tell people to install any phpX.YY package! Ever. Do not link to pages that tell people to install php or php8.4 or whatever.

@Jamie, it was implemented here:

@Jamie, check out my latest changes to this part of the code. And, adding a delete button next to save is not very difficult, so we should support that too, I think.

I was really not sure to understand but after searching I found:

Please link to this topic if you want us to understand a minimum.

Do not tell people to install any phpX.YY

Still I don’t understand this one. I’m on 8.2 and, as long as we don’t pick randomly the module, didn’t get any problems (Still I’m on FPM)

I tried to show why you should not install the package named, e.g. php8.4 or php8.2 or whatever the heck. Don’t install that damned package, I’m begging you. It depends on mod_php, and mod_php has been deprecated for well over a decade. I literally do not know how to be more clear. Stop installing php or php8.2 or php8.4 or any phpX.Y package. That package does nothing but depend on PHP execution modes…but, the execution mode it depends on first is mod_php, and that should never be used. So, please stop doing it and stop telling people to do it and stop linking to websites that tell people to do it.

Our documentation tells you how to install PHP, there is no reason to link to third-party documentation that tells people how to break their system by installing mod_php.

They can’t actually do it. We don’t allow it.

Sorry I have to missread because when I quote your own doc:

On Debian

  1. Enable Sury/PHP repository
apt-get -y install apt-transport-https lsb-release ca-certificates curl && curl -sSL -o /usr/share/keyrings/debsuryorg-archive-keyring.gpg https://packages.sury.org/php/apt.gpg && sh -c 'echo "deb [signed-by=/usr/share/keyrings/debsuryorg-archive-keyring.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/sury-debian-php-$(lsb_release -sc).list' && apt-get update
  1. Install PHP packages
apt-get install php8.1-{cgi,cli,fpm,pdo,gd,mbstring,mysqlnd,opcache,curl,xml,zip}
  • Replace php8.1 with the desired version, e.g., php8.3.
  • Check available PHP versions and extensions on the SURY website or via apt-cache search --names-only ^php.
apt-get install php8.1-

It’s exactly what I said above. Again I have to be missreading :upside_down_face: