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 communityIt 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.
Ubuntu package details says php
(php7.2
) depends on libapache2-mod-php7.2
OR php7.2-fpm
OR php7.2-cgi
.
It seems to default to the first package, which itself depends on apache2
. But if you install one of the latter first, and php
afterwards, 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
sudo apt-get --no-install-recommends --dry-run install php
First simulate. I'm not in ubuntu now. If you are happy you can run
sudo apt-get --no-install-recommends install php
php
will install a web server to go with it as it defaults to the Apache module first. OP would have to install either the php-cgi
package or php-cli
package first before trying to install php
- however if they install php-cgi or php-cli they'll get all the PHP common dependencies anyways which does not include a web server.
– Thomas Ward♦
Jul 23 '19 at 19:43
sudo apt install php
will do. – pLumo Jul 23 '19 at 14:29