WSL2 This is the procedure to install PHP7.4 on Ubuntu 20.04.
Host OS: WIndows10 home Guest OS: WSL2 Ubuntu 20.04
Execute the following command.
① Check the package update
$ sudo apt update
(2) Install the software-properties-common package.
$ sudo apt install software-properties-common
I want to add a repository in ③, but the command to add a repository is not installed by default. The packages installed here are for adding repositories.
③ Add a repository
$ sudo add-apt-repository ppa:ondrej/php
④ Update the package again. (① Same procedure)
⑤ Install PHP
$ sudo apt install php7.4
After checking the version, if the following is displayed, the installation is complete.
$ php -v
PHP 7.4.7 (cli) (built: Jun 12 2020 07:44:38) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.7, Copyright (c), by Zend Technologies
Finally, check the installation location of php.
$ which php
/usr/bin/php
(Not found with the find command. Why ...)
Recommended Posts