-6

I have Ubuntu 16.10 installed on virtual machine on virtualbox on windows 10. I've installed lamp stack through "tasksel" command, but it installed apache2 and php7.

My question is: How can i install php5 (latest version and all its relative/most used modules) and set as default php?

Thank you

jww
  • 97,681
  • 90
  • 411
  • 885
user2548436
  • 915
  • 2
  • 16
  • 35
  • 7
    `I accept as answer only a complete list of all command and various settings that i've to perform.` You doesn't sound like a very frendly man who I would like to help... You are the one who should do most of the effort, not the people who want to help you. Please, just use Google for such a question. Good luck and a happy New Year :)! – Sander Dec 31 '16 at 18:40
  • So don't help me :-) I only wrote this because often the answer is very short and not very helpfull. Because I'm newbie on linux, for me is important that nothing is overlooked – user2548436 Dec 31 '16 at 18:45
  • This should help: http://askubuntu.com/questions/761713/how-can-i-downgrade-from-php-7-to-php-5-6-on-ubuntu-16-04 – Sander Dec 31 '16 at 18:49
  • PHP5.3? I thought you wish him a happy new year... – Federkun Dec 31 '16 at 18:53
  • not 5.3 but php5.6 – user2548436 Dec 31 '16 at 18:55
  • i launched the command sudo apt-get install php5 but the shell says: Package php5 has no installation candidate – user2548436 Dec 31 '16 at 18:56
  • @user25 This should help: http://stackoverflow.com/questions/36788873/package-php5-have-no-installation-candidate-ubuntu-16-04 Did take me probably less time to Google for this than typing the question did for you ;). – Sander Dec 31 '16 at 19:00
  • @Federkun Your right, changed the edit ;). – Sander Dec 31 '16 at 19:00
  • How to set as default php ? – user2548436 Dec 31 '16 at 19:08
  • @user25 http://superuser.com/questions/669312/make-a-certain-software-version-the-default-in-ubuntu – Sander Dec 31 '16 at 19:13
  • Don't create a list of demands. Don't come here for coaching. This site requires focused specific technical questions and expects you to do your research to learn the technology you're using. It doesn't sound like you did that. People are not volunteering time here to hold your hand through a whole process we are here to clear up very specific targeted areas of technical struggle where people have done their homework and are really stuck. The way you have phrased it is trollish and offensive and I would recommend deletion of the question unless you edit it & correct aforementioned problems – clearlight Jan 01 '17 at 03:05
  • Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. Also see [Where do I post questions about Dev Ops?](http://meta.stackexchange.com/q/134306) – jww Jan 02 '17 at 20:00

1 Answers1

0

Add the ppa

sudo add-apt-repository ppa:ondrej/php5-5.6

Then install python-software-properties first to avoid some errors that might occur

sudo apt-get update
sudo apt-get install python-software-properties

Then install php

sudo apt-get update 
sudo apt-get install php5

To switch to different php versions,assuming you are using both php5.6 and php7.0

Using apache you can do

sudo a2dismod php5.6  ##To use php5.6
sudo a2enmod php7.0   ##To use php7.0
sudo service apache2 restart