Jump to content
Froxlor Forum
  • 0

Uninstall unused PHP-versions


techie204

Question

I wanted to clean up our system today since we only use one php-version (now 8.0). Unfortunately I cannot delete 7.4 since it would uninstall froxlor package also. From what I found I assume the dependency of froxlor to php-cgi is relevant!? But why isn't it using the php8.0-cgi package? Or do I miss something?

# apt remove php7.4*
The following packages will be REMOVED:
  froxlor libapache2-mod-php7.4 php7.4 php7.4-bcmath php7.4-cgi php7.4-cli
  php7.4-common php7.4-curl php7.4-gd php7.4-imap php7.4-json php7.4-mbstring
  php7.4-mysql php7.4-opcache php7.4-readline php7.4-xml php7.4-zip

I don't actually know if it has something to do with this, but had problems with meta-packages before and can't figure this one out now:

# apt depends froxlor --installed
...
|Depends: php-cgi (>= 1:7.1)
...

Anyway, how can I uninstall the old PHP version without uninstalling froxlor!?

Link to comment
Share on other sites

Recommended Posts

  • 0

Thanks for your answer and question. I dont' get it actually 🙂 thought it might work with 8.1, but I do have the same problem.

php-packages installed:

php8.1 php8.1-bcmath php8.1-cgi php8.1-cli php8.1-common php8.1-curl php8.1-gd php8.1-imap php8.1-mbstring php8.1-mysql php8.1-opcache php8.1-readline php8.1-xml php8.1-zip

From the 7.4-branch still installed, but I'd like to remove:

php7.4-common php7.4-json

If I want to remove them, apt is trying to uninstall froxlor:

# apt remove php7.4-common
...
The following packages will be REMOVED:
  froxlor php7.4-common php7.4-json

Furthermore I do have the following meta-packages installed:

php-cgi/buster,now 2:8.1+92+0~20220117.43+debian10~1.gbpe0d14e all [installed,automatic]
php-common/buster,now 2:92+0~20220117.43+debian10~1.gbpe0d14e all [installed,automatic]

For php-common I do understand that it's ok (and obviously also needed as meta-package for froxlor and php in general!), since version numbering is not increasing when a new php-major-version comes out (I mean it's not dragging new php-version), ... but for php-cgi!? When I do want to remove meta-package, then php-package is supposed to be installed!?

# apt remove php-cgi
...
The following packages will be REMOVED:
  php-cgi
The following NEW packages will be installed:
  php

As dependency it might be necessary this way:

# apt depends froxlor --installed
...
 |Depends: php-cgi (>= 1:7.1)

This package again seems to be dependent on different pecls, that are required: cli bcmath curl mbstring mysql xml zip
But!!! as also json, which is only available till 7.4!!! and not in 8.0/8.1: https://php.watch/versions/8.0/ext-json

How can this be fixed?

Link to comment
Share on other sites

  • 0

I installed the package and now it was possible to uninstall the 7.4-packages. But it lead to another meta-package to be installed:

The following additional packages will be installed:
  php-json
The following packages will be REMOVED:
  php7.4-common php7.4-json

Still doing it, the following output came, but software still works:

dpkg: php7.4-json: dependency problems, but removing anyway as you requested:
 froxlor depends on php-json | php (>= 1:8.0); however:
  Package php-json is not configured yet.
  Package php7.4-json which provides php-json is to be removed.
  Package php is not installed.
  Version of php on system, provided by php8.1:all, is <none>.

Thanks for the changes!
Anyway. I still don't get the dependency of the meta-packages:

php-cgi/buster,now 2:8.1+92+0~20220117.43+debian10~1.gbpe0d14e all [installed,automatic]
php-json/buster,now 2:8.1+92+0~20220117.43+debian10~1.gbpe0d14e all [installed,automatic]

The problem is, that when they bump the meta-packages to a newer version, it's supposed to be installed (and with autoupdates it will) and then I do have a mixed setup 😞
1. php-json seems to be integrated in PHP in general and doesn't need an extra install anymore since 8.0 (as I wrote above)
2. I don't get the need for php-cgi, since php8.1-cgi is installed

If this could be changed also, it would be a charme 🙂 but maybe I'm not getting the structure or dependencies in other parts. Thanks already for all!

Link to comment
Share on other sites

  • 0
12 minutes ago, techie204 said:

1. php-json seems to be integrated in PHP in general and doesn't need an extra install anymore since 8.0 (as I wrote above)

yes, that's why the depend string is: php-json | php (>= 1:8.0)
meaning: php-json OR php>=8.0

tests by a community member have shown that he could remove php-7.4 perfectly fine

13 minutes ago, techie204 said:

2. I don't get the need for php-cgi, since php8.1-cgi is installed

Thats because php-cgi depends on php-json.

15 minutes ago, techie204 said:
dpkg: php7.4-json: dependency problems, but removing anyway as you requested:
 froxlor depends on php-json | php (>= 1:8.0); however:
  Package php-json is not configured yet.
  Package php7.4-json which provides php-json is to be removed.
  Package php is not installed.
  Version of php on system, provided by php8.1:all, is <none>.

This looks to me like your php8.1 does not provide the meta package 'php' correctly, hence the check for "php-json | php (>= 1:8.0)" cannot be satisfied. Although apt-cache show php8.1 shows that it should provide 'php'

 

Link to comment
Share on other sites

  • 0

Yes, it is:

# php -v
PHP 8.1.2 (cli) (built: Jan 27 2022 12:20:56) (NTS)

The things in the post before I do not get completely 🙂 but I see, that actually the meta-package should be provided:

# apt-cache show php8.1
Package: php8.1
Version: 8.1.2-1+0~20220127.12+debian10~1.gbpe46588
...
Depends: libapache2-mod-php8.1 | php8.1-fpm | php8.1-cgi, php8.1-common
Provides: php

 

Link to comment
Share on other sites

  • 0

Remove complete php install from your Sys

Remove PHP

sudo apt remove php7* php8* -y

Install New Package

1. sudo apt update
2. sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2

Sury Install

1. sudo echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
2. wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
3. sudo apt update

PHP install

1. sudo apt install php8.1
2. sudo apt install php8.1-{mysql,cli,cgi,common,imap,ldap,xml,fpm,curl,mbstring,zip}

Froxlor Download & Install

1. wget https://files.froxlor.org/testing/froxlor-0.10.33-2.deb
2. sudo apt install path/froxlor-0.10.33-2.deb

 

Link to comment
Share on other sites

  • 0

Does this keep all froxlor-configurations, accounts, mails and so on? (especially with the autopurge above I'm quite concerned!)

Actually for completeness I also should remove all php*-packages, no?

"New Package" and "sury" are already installed. What I realised now is that with your PHP-install there are 2 packages not installed right now: fpm and ldap ... but since we only use mails on the server, it should not be the problem we have here.

Link to comment
Share on other sites

  • 0

No, that kills everything. the problem when installing froxlor via .deb comes dependencies, so it will be removed with it if you clean delete php.

You can back up your Froxlor database before removing and if you want, back up your Froxlor install directory as well. and later import everything again from the database if you have installed PHP correctly and then load and install Froxlor directly via git.

as for /var/customers/... that's not actually removed. also means your emails are safe.

But to be on the safe side, always make a copy of everything on a server beforehand.

Link to comment
Share on other sites

  • 0

Wait what? No it will NOT delete everything....the database will surely not be removed (how should apt know about that?!) and same goes for mail etc. you are just removing what the debian package installs, and that's all the files within /var/www/froxlor ....(backup can't hurt though). You especially want to keep froxlor/lib/userdata.inc.php someplace else so you can later just copy it back and return to your installed froxlor

Link to comment
Share on other sites

  • 0

I was asking because starting with the removal, it says the following:

The following packages were automatically installed and are no longer required:
  courier-authlib default-mysql-client default-mysql-server expect galera-3 libc-client2007e libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libcourier-unicode4 libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl libgd3 libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl libjbig0 libjpeg62-turbo liblwp-mediatypes-perl libonig5 libsnappy1v5 libtcl8.6 libterm-readkey-perl libtiff5 libtimedate-perl libtk8.6 libwebp6 libxslt1.1 libxss1 libzip4 maildrop mariadb-client-10.3 mariadb-client-core-10.3 mariadb-server-10.3 mariadb-server-core-10.3 mlock php-common socat tcl-expect tcl8.6 tk8.6 webalizer

When autoremoving these packages with --purge, then also the databases are purged, no?

Shouldn't it be possible to clean up php without autoremoving/autopurging everything else? Then the dependencies should be fine, too, no?

Link to comment
Share on other sites

  • 0

So I did a bit of testing. Problem seems to be with php8.0, for 8.1 debian again provides a php8.1-json (virtual?) package.

What DID work though for php8.0 (and removal of 7.4) is having both installed and then, before trying to remove just run:
 

apt-mark hold froxlor

then - at least in my case - the froxlor package won't get removed

Link to comment
Share on other sites

  • 0
22 minutes ago, d00p said:

So I did a bit of testing. Problem seems to be with php8.0, for 8.1 debian again provides a php8.1-json (virtual?) package.

What DID work though for php8.0 (and removal of 7.4) is having both installed and then, before trying to remove just run:
 

apt-mark hold froxlor

then - at least in my case - the froxlor package won't get removed

This leads to other unexpected problems 🙂 I will check this all tonight again and try it, after making the necessary backups. Thanks in advance.

Link to comment
Share on other sites

  • 0
On 2/10/2022 at 3:44 PM, みゆき said:

Remove PHP

sudo apt remove php*

PHP install

1. sudo apt install php8.1 php8.1-{mysql,cli,cgi,common,imap,ldap,xml,fpm,curl,mbstring,zip,gd,bcmath}

Froxlor Download & Install

1. wget https://files.froxlor.org/testing/froxlor-0.10.33-2.deb
2. sudo apt install path/froxlor-0.10.33-2.deb

So, thats what I now did (everything else from the quoted post was already done. This leeds to meta-package php stills needs to be installed 😞 unfortunately:

The following NEW packages will be installed:
  froxlor php

Seems a bit strange to me ... or am I missing something?

Link to comment
Share on other sites

  • 0
On 2/15/2022 at 11:33 PM, techie204 said:

So, thats what I now did (everything else from the quoted post was already done. This leeds to meta-package php stills needs to be installed 😞 unfortunately:

The following NEW packages will be installed:
  froxlor php

Seems a bit strange to me ... or am I missing something?

Hey, I try it again 🙂 does anybody have a clue, why the dependency still ist there? What I figured out right now:
 

# apt list php* --installed
Listing... Done
php-common/bullseye,now 2:92+0~20220117.43+debian11~1.gbpe0d14e all [installed,automatic]
php8.1-bcmath/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed]
php8.1-cgi/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed]
php8.1-cli/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed]
php8.1-common/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed]
php8.1-curl/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed]
php8.1-fpm/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed]
php8.1-gd/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed]
php8.1-imap/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed]
php8.1-ldap/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed]
php8.1-mbstring/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed]
php8.1-mysql/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed]
php8.1-opcache/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed,automatic]
php8.1-readline/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed,automatic]
php8.1-xml/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed]
php8.1-zip/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c amd64 [installed]
php8.1/bullseye,now 8.1.4-1+0~20220320.14+debian11~1.gbp16e58c all [installed]
php/bullseye,now 2:8.1+92+0~20220117.43+debian11~1.gbpe0d14e all [installed,automatic]

When I check on the reverse dependency for php, it seems correct with froxlor:

# apt rdepends php --installed
php
Reverse Depends:
 |Depends: froxlor (>= 1:7.1)
  Depends: froxlor (>= 1:8.0)

-> php8.1 is installed >=8.0, but when I try to uninstall meta-package, the following happens again:

# apt remove php
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  php-cgi php-json
The following packages will be REMOVED:
  php
The following NEW packages will be installed:
  php-cgi php-json

php8.1-cgi is also installed, php8.1-json doesn't exist anymore, as stated somewhere above. Froxlor-Version now is updated to 0.10.34 from debian-repo.

Anybody a clue?

Link to comment
Share on other sites

  • 0
1 minute ago, d00p said:

Why remove virtual/meta package? If you want to remove a specific version, specify it when invoking "apt remove" 

I don't know why I need meta-packages. I want to stick to a certain PHP-Version and have minor updates installed automatically (unattended upgrades). With other software I always have phpx.y installed and everything is fine.

So the main reason is, that I do not want php-package to get upgraded, when they bump the version to a higher major version (then 8.2), because then  everything gets mixed up.

Link to comment
Share on other sites

  • 0

Well this does not happen if you stick to the default distribution apt.sources....this is definetly a debian/apt topic you can google how to avoid installing newer major versions of specific packages

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • Create New...