It seems that the only way to do this is to install together an Apache server which is very-very unwanted (in our case).
We just want to utilize the simple built-in web server, as the lucky users of some non-ubuntu OSes (like MS Windows 10) have.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
Ubuntu package details says
php7.2) depends on
It seems to default to the first package, which itself depends on
apache2. But if you install one of the latter first, and
apache2 will not be installed.
sudo apt install php-cgi sudo apt install php
or manually put the resolved dependency:
sudo apt install php php7.2-cgi
Then you can run
php -S localhost:8000