How bởi vì I install different (nâng cấp or downgrade) PHP.. version in still supported Ubuntu release? (2 answers)
I need khổng lồ use php5 (5.6) because I"m working on a Drupal 7 project which doesn"t tư vấn php7. The problem is I recently updated to ubuntu 16.04 Xenial which seems to lớn no longer support php5.

I tried lớn install it from this repo, however when It try to install it with apt I always get similar errors.

Bạn đang xem: Apt

$ suvì chưng apt-get install php5-cliCependant les paquets suivants le remplacent : php7.0-cli:i386 php7.0-cli`Which means it"s obsolete. How can I install PHP 5.6 on Xenial?



Remove sầu all the stoông chồng php packages

List installed php packages with dpkg -l | grep php| awk "print $2" |tr " " " " then remove sầu unneeded packages with subởi vì aptitude purge your_packages_here or if you want to directly remove sầu them all use :

suvị apt-get purge `dpkilogam -l | grep php| awk "print $2" |tr " " " "`Add the PPA

suvì chưng add-apt-repository ppa:ondrej/phpIf you get add-apt-repository: command not found run the following command first :

suvì chưng apt-get install software-properties-commonInstall your PHP Version

sudo apt-get updatesuvày apt-get install php5.6You can install php5.6 modules too for example

subởi vì apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xmlVerify your version

If you have installed php5.6-cli

suvị php -vIf you don"t have php5.6-cli, put this on a .php file

Improve sầu this answer
edited Jan 12 "17 at 15:33


answered Atruyền thông quảng cáo 11 "16 at 10:09

4,73444 gold badges2828 silver badges4444 bronze badges
| Show 10 more comments
Run the following commands:

$ suvì apt-get install python-software-properties$ subởi vì add-apt-repository ppa:ondrej/php$ subởi apt-get update$ suvì apt-get install -y php5.6Check your PHPhường Version

php -v
Improve sầu this answer
answered Mar 27 "17 at 20:43


Antonio NicasioAntonio Nicasio
14111 silver badge44 bronze badges
Add a bình luận |
You can even consider using vagrant (or similar technology) to assist in using both versions at the same time. Vagrant is essentially a VM client designed khổng lồ help spin VM"s up và down quickly and easily with project based configuration; i.e. you can configure a VM specifically for a project & each VM can be different per project if need be.

Xem thêm: append file php

This means that you can develop a project & demo it on your local machine using the same production configuration as the project will be run under. Not only is this great for yourself but also means that a team of developers can always kiểm tra under the same circumstances as the VM configuration is portable & cross-platform (it"s just a text file).

Once vagrant and virtual box are installed, it"s as easy as running:

vagrant init ubuntu/trusty64; vagrant up --provider virtualboxand once the vm is up & running you can use:

vagrant sshand you can now manually install apabít, php and mysql. You can also define a provisioning configuration, so that when you enter:

vagrant upthe VM builds itself as well as installs all the binaries you need and can even vị a git clone of your code, thiết đặt networking so you can view the application in your browser, etc.

For more detailed information look here: https://www.vagrantup.com/docs/getting-started/