I want to install php 5 (any version, from 5.3 to 5.6) on Ubuntu 16.04 without installing Apache 2.4.

(I have installed Apache 2.2 following the suggestion from http://blog.thestateofme.com/2015/07/23/apache-2-2-on-ubuntu-14-04/ )

The answer to How do I install different (upgrade or downgrade) PHP version in still supported Ubuntu release? suggests ppa:ondrej/php and other PPAs which install Apache 2.4.

I have tried to use Precise repositories but did not succeed.

My purpose is to keep a localhost mirror of my site which runs with Apache 2.2 and PHP 5. (PHP 7.0 breaks the currently installed version of one of the plugins.)

Please help.

  • I understand wanting to keep them the same... But is there something about 2.4 that makes you not want to use it? – user508889 Oct 20 '16 at 22:14
  • I want to keep the localhost mirror of my site on my home comp to be able to test changes before applying them to my live site. My hosting provider runs Apache 2.2 and I heard that 2.4 differs significantly in some aspects. There is no point in having a mirror that differs significantly from the live site. – Baruch Youssin Oct 20 '16 at 22:29
  • It differs in configuration options sure, but if you're using php, I don't see how it could really make a difference. I know it doesn't answer the question, but YMMV. – user508889 Oct 20 '16 at 22:43
  • I have a Wordpress site and I have no idea how 2.2/2.4 would affect Wordpress configuration or any of the plugins I am using. – Baruch Youssin Oct 20 '16 at 22:48

The reason why apt-get is installing Apache2 because it is resolving a dependency. To satisfy that dependency first install php5-fpm before php5:

sudo apt-get -y install php5-fpm php5

This should solve the issue you are having. I got this answer from here

| improve this answer | |
  • Thanks! I have given up on this issue and installed Apache 2.4 so I cannot test your suggestion. Hope someone else will benefit from it. – Baruch Youssin May 5 '17 at 5:41

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.