5

Installing php7.1 using this command:

sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update

sudo apt-get install -y php7.1
#Modules
sudo apt-get install -y php7.1-cli 
sudo apt-get install -y php7.1-common 
sudo apt-get install -y php7.1-json 
sudo apt-get install -y php7.1-opcache 
sudo apt-get install -y php7.1-mysql 
sudo apt-get install -y php7.1-mbstring 
sudo apt-get install -y php7.1-mcrypt 
sudo apt-get install -y php7.1-zip 
sudo apt-get install -y php7.1-fpm
sudo apt-get install -y php7.1-xml
sudo apt-get install -y php7.1-xmlrpc
#sudo apt-get install -y php-token-stream

It is installing Apache. I don't want this. It is being installed during the install -y php7.1.

enter image description here

is there a way to avoid Apache during this php7.1 installation?

IgorAlves
  • 1,162

2 Answers2

6

As you can see with, e.g., apt show php7.1, php7.1 depends on libapache2-mod-php7.1 OR php7.1-fpm OR php7.1-cgi. If none of those packages are installed, Apt will install the first one, libapache2-mod-php7.1, which in turn depends on Apache. But you want to install php7.1-fpm instead; in that case you can either install it before php7.1 or simultaneously (i.e., sudo apt install php7.1 php7.1-fpm).

fkraiem
  • 12,813
0

The PHP package from Ubuntu's repository doesn't automatically install Apache2. It will only install PHP and its dependencies (which doesn't depend on Apache2 being installed).

The PPA PHP package you are installing is including Apache2 as part of its install configuration.

Savior123 has already suggested that you can purge apache2 after you install PHP.

The PPA, in this case, maybe using some of the libraries or components of Ubuntu's Apache2 as dependencies. For you should disable the Apache2 service, rather than uninstalling it.

It won't use any resources unless it has been started and is running. So it won't conflict with whatever other Web server you might alternatively install.

The command for disabling a service (stopping it from automatically starting on boot) is:

$ sudo systemctl disable apache2
L. D. James
  • 25,444