Score:0

Can't install php7.4 on WSL Ubuntu

br flag

I'm having trouble installing php7.4 on ubuntu 20 with the following command

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.4

On my ubuntu partition it works just fine, but when trying to install it on WSL and typing php -v I get that the current version is PHP 7.3.32 (cli)

guiverc avatar
cn flag
Ubuntu 20? Ubuntu Core 20 doesn't use `apt` commands; that's used only by *year.month* format releases; as the *year* format products are *snap* only.
Ramiro Herrera avatar
br flag
Oh my bad then, I was under the impression that ubuntu 20 gets installed while using wsl
in flag
If you have multiple versions of PHP installed, you’ll need to set the version you want to use [via `update-alternatives`](https://askubuntu.com/a/1373766/1222991)
ChanganAuto avatar
us flag
What guiverc above means is that you're likely using Ubuntu 20.04 because "Ubuntu Core 20" is a different product. When asking you should be precise.
Ramiro Herrera avatar
br flag
@matigo I tried running `sudo update-alternatives --config php` and was presented with the php8.0 and php7.4 options (both on /usr/bin) but even after manually changing them, when I run `php -v` I keep getting the 7.3.32 version. Also, said version wasn't listed when I executed the `update-alternatives` command
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.