I want to remove and purge apache2 - Why does this trigger an install of php5-cgi ?

sudo apt-get --purge remove apache2

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-3.19.0-20 linux-headers-3.19.0-20-generic linux-image-3.19.0-20-generic linux-image-extra-3.19.0-20-generic linux-signed-image-3.19.0-20-generic linux-tools-3.19.0-20
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
Suggested packages:
The following packages will be REMOVED:
  apache2* libapache2-mod-php5*
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 2 to remove and 15 not upgraded.
Need to get 4,419 kB of archives.
After this operation, 8,152 kB of additional disk space will be used.
Do you want to continue? [Y/n] n

When I issued above, it did in fact install that new package! I would not think it's an alternative

1 Answer 1


The package php5 depends on having either apache2 or cgi installed.

The two main options to satisfy this dependency is either libapache2-mod-php5 or php5-cgi.

If you remove one, the system will install the other, otherwise php5 would have an unmet dependency.

You can see the dependencies at php5 in the Ubuntu packages database.

  • 1
    OK next time I first remove php5 then apache2 Jul 8, 2015 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.