I am working on some local PHP and Laravel development on Ubuntu 22.04. I'm having a problem with PHP 8.1 and Apache2 being automatically installed by apt
. This ends up taking precedence over the 8.3 version I compiled myself. I don't need or want the 8.1 version, or frankly, the apache2 server (locally at least). I want to only use version 8.3. It seems to be happening when the computer goes into sleep mode, or if it's restarted. I remove all the packages with apt
, but they just keep coming back. Very frustrating!
The output of apt list --installed | grep php
is as follows:
libapache2-mod-php8.1/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.14 amd64 [installed,automatic]php-common/jammy,jammy,now 2:92ubuntu1 all [installed,automatic]php8.1-cli/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.14 amd64 [installed,automatic]php8.1-common/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.14 amd64 [installed,automatic]php8.1-opcache/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.14 amd64 [installed,automatic]php8.1-readline/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.14 amd64 [installed,automatic]php8.1/jammy-updates,jammy-updates,jammy-security,jammy-security,now 8.1.2-1ubuntu2.14 all [installed,automatic]php/jammy,jammy,now 2:8.1+92ubuntu1 all [installed]
and apt list --installed | grep apache2
apache2-bin/jammy-security,now 2.4.52-1ubuntu4.7 amd64 [installed,upgradable to: 2.4.52-1ubuntu4.8]apache2-data/jammy-security,jammy-security,now 2.4.52-1ubuntu4.7 all [installed,upgradable to: 2.4.52-1ubuntu4.8]apache2-utils/jammy-security,now 2.4.52-1ubuntu4.7 amd64 [installed,upgradable to: 2.4.52-1ubuntu4.8]apache2/jammy-security,now 2.4.52-1ubuntu4.7 amd64 [installed,upgradable to: 2.4.52-1ubuntu4.8]libapache2-mod-php8.1/jammy-updates,jammy-security,now 8.1.2-1ubuntu2.14 amd64 [installed,automatic]
Things I've tried:I saw other answers in regards to determining why a package is automatically instlled using aptitude
. I've tried chasing down the culprit package without much success. Things like
aptitude why libapache2-mod-php8.1i php Depends php8.1 i A php8.1 Depends libapache2-mod-php8.1 | php8.1-fpm | php8.1-cgiaptitude why php8.1-cli i php Depends php8.1 i A php8.1 Depends libapache2-mod-php8.1 | php8.1-fpm | php8.1-cgii A libapache2-mod-php8.1 Depends php8.1-cli aptitude why php8.1 i php Depends php8.1
have not been very useful. I've tried removing all of the unwanted packages with apt
, but they just keep coming back automatically. I obviously don't want to remove these by hand & reinstall my compiled 8.3 version every time I fire up the computer.
I have not tried using a PHP version manager, but at this time, I don't need any other versions of PHP. So I haven't gone down that route. I'd rather learn how to discover why this is happening & manage the situation on it's own.
This is above my knowledge of Ubuntu administration, and I'm having trouble searching for any similar problems. Any guidance would be appreciated!.