简体   繁体   中英

Package php5 has no installation candidate on Ubuntu 16.04 LTS

I have upgraded my system to ubuntu 16.04 LTS, now I have issue this newer version install PHP 7 and remove the PHP 5, How I can install PHP 5.4 on ubuntu 16.04 LTS?

I tried:

sudo apt-get install php5

and I got this error:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package php5 is not available but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package php5 has no installation candidate

Ubuntu 16.04 comes with PHP7 ,there are no PHP5 packages. Remove all php7 packages:

sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "

New PPA

sudo add-apt-repository ppa:ondrej/php

Update packages:

sudo apt-get update

Install PHP:

sudo apt-get install php5.6

Check PHP Version:

php -v

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM