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,122
  • 6
  • 18
  • 34
  • The picture of your output is hard to read. It is easier on the users trying to help if you would copy and paste text instead of pictures of the text. Many users have their systems formatted with size, color, and other settings that is missing when trying to deal with a picture of the text. – L. D. James Dec 21 '17 at 23:35
  • What do you want to do? If you only want to run `php` on the CLI, just install `php7.1-cli`, no need for `php7.1`. – fkraiem Dec 22 '17 at 00:42
  • @fkraiem The reason I didn't suggest php7.1-cli in my answer is because it appeared from the OP's question that Apache2 would be a conflict... meaning he will be installing a different Web server. For that reason, it would be best to disable the default Apache installation. – L. D. James Dec 22 '17 at 15:18
  • @L.D.James I don't know where you see in the question that OP wants to install another Web server; all we know so far is that he does not want to install Apache. – fkraiem Dec 23 '17 at 00:15
  • @fkraiem I got it from his reference to Apache. From my experience, people trying to run NGINX or Apache have a conflict with both installed. Stopping one from starting up has always resolved the issue. That is why I mentioned in my answer, having it disabled would not interfere with his choice web server. – L. D. James Dec 23 '17 at 00:35
  • @L.D.James Yes, I had overlooked `php7.1-fpm` in the question... – fkraiem Dec 23 '17 at 00:42
  • @fkraiem I had overlooked it also. I had been testing my answer and working on the update but using `sudo apt install php` and not specifying the version number. I was going to include it in my answer that as long as all the proper updates are installed, the software manager would install the latest... specifying the version wasn't necessary. The OP interrupted my organizing the answer with comment updates, whereas he pointed out that he was using a PPA for an install outside of Ubuntu's repository... (continued)... – L. D. James Dec 23 '17 at 00:49
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/70705/discussion-between-l-d-james-and-fkraiem). – L. D. James Dec 23 '17 at 00:49

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,344
  • 4
  • 33
  • 38
  • Note: [the official `php7.0` package in Xenial](https://packages.ubuntu.com/xenial/php7.0) has `php7.0-fpm` listed first, which is why it will not pull Apache automatically. This was [changed in 7.1](https://packages.ubuntu.com/artful/php7.1). – fkraiem Dec 23 '17 at 00:48
  • Perfect! It works. That was the explanation. I just started with `sudo apt-get install -y php7.1-fpm` before `sudo apt-get install -y php7.1` and Apache was not instaled. – IgorAlves Dec 23 '17 at 03:15
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
  • 24,768
  • 10
  • 68
  • 116
  • those who downvote shoud be obigated to explain why, since it is not a contructive practice itsef. Hi LD James, it seems that php7.1 is comming with apache, by default. that lead us to delete or disabe apache if we dont need it. – IgorAlves Dec 22 '17 at 03:19
  • 1
    @zwitterion I agree with you about the overzealous downvoters. Some people are just anxious to contribute. but sometimes missing some of the important gist of the contribution. And you're right about the default of the way PHP is packaged. I'm sure that both answers address the issue of your question. It's up to you (and others of course) to cancel out some of the negative input, if you see merit in any of the answers with an upvote. I'm sure it's better for someone to contribute the information that you are starting to realize, rather just leave you and the question hanging. – L. D. James Dec 22 '17 at 06:50
  • Yes. I tink te best option now will be for now, to uninstall te apace, because it is breaking my nginx after I install pp7.1 – IgorAlves Dec 22 '17 at 14:49
  • @zwitterion I'm running some test and will update my answer accordingly in a few minutes. – L. D. James Dec 22 '17 at 14:54
  • Nice, I'v try to purge Apache in a clean way but it is not going smoothly. – IgorAlves Dec 22 '17 at 14:59
  • I wouldn't recommend that as the best way. As I mentioned in my current answer, it might interfere with the integrity of the PHP installed dependencies. – L. D. James Dec 22 '17 at 15:00
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/70678/discussion-between-l-d-james-and-zwitterion). – L. D. James Dec 22 '17 at 15:08
  • I have retracted my downvote, but this answer is still not correct. It makes no sense to compare the `php7.0` package in Xenial with the `php7.1` package in the PPA, because `php7.0` and `php7.1` are **different packages**. The `php7.1` package on the PPA is identical to the one in later Ubuntu versions. – fkraiem Dec 23 '17 at 02:17
  • @fkraiem I didn't apply any comparison of php7.0 to php7.1. My reference to difference was my observation that the PPA that the user had installed was behaving differently from the three test machines I used to test my answer and suggestion. I didn't install the PPA. However, I noticed that the output he showed from his PPA installation was different from the output that I got from all my test machines. I don't know how the repository of PHP will behave in future versions of Ubuntu. (cont...) – L. D. James Dec 23 '17 at 02:32
  • You couldn't possibly have installed `php7.1` on 16.04 without enabling the PPA, because it does not exist in the official repositories. – fkraiem Dec 23 '17 at 02:35
  • (...cont) Unless it's specified differently I make references to the latest LTS versions in my support recommendations and answers. In this case, the OP specified 16.04 LTS. Had he not specified, I would have mentioned I was referring to Ubuntu 16.04 LTS. My answer was describing the behavior of the latest update of the PHP that is in the Ubuntu disribution repository. – L. D. James Dec 23 '17 at 02:36
  • I redownvoted; your answer is simply not correct because it refers to a different package than the one OP is trying to install. – fkraiem Dec 23 '17 at 02:41
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/70707/discussion-between-l-d-james-and-fkraiem). – L. D. James Dec 23 '17 at 02:43
  • Hi L.D. I am running 16.04.3 – IgorAlves Dec 23 '17 at 11:52