I tried to use this command to install php in Ubuntu 16.04:
sudo apt-get install php5 libapache2-mod-php5
But it shows:
'php5' has no installation candidate
How can I install it?
Ubuntu 16.04 comes with PHP7, so there are no PHP5 packages.
However, if you like, you can add a PPA to get those packages:
Remove all the stock php packages
List installed php packages with dpkg -l | grep php| awk '{print $2}' |tr "\\n" " " then remove unneeded packages with sudo aptitude purge your_packages_here or if you want to directly remove them all use :
sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
Add the PPA
sudo add-apt-repository ppa:ondrej/php
Install your PHP Version
sudo apt-get update
sudo apt-get install php5.6
You can install php5.6 packages.
Then, verify your PHP version
sudo 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.