Installation Php for WSL2 notes

Installatoion and print version

root@galaxy-book-go:~# apt install php
root@galaxy-book-go:~# php --version
PHP 7.4.3 (cli) (built: Nov  2 2022 09:53:44) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies

Debian GNU/Linux へのインストール https://www.php.net/manual/ja/install.unix.debian.php

例1 DebianApache 2 と組み合わせるインストール例

# apt install php-common libapache2-mod-php php-cli

例2 PHP インストール後に Apache を停止・起動させる

# /etc/init.d/apache2 stop
# /etc/init.d/apache2 start

Home directory location

root@galaxy-book-go:/var/www/html# ls -la
total 24
drwxr-xr-x 2 root root  4096 Nov 22 00:22 .
drwxr-xr-x 3 root root  4096 Nov 21 23:56 ..
-rw-r--r-- 1 root root    19 Nov 22 00:22 a.php
-rw-r--r-- 1 root root 10918 Nov 21 23:56 index.html