软件包php5没有安装候选版本(Ubuntu 16.04) [英] Package php5 have no installation candidate (Ubuntu 16.04)

查看:388
本文介绍了软件包php5没有安装候选版本(Ubuntu 16.04)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用以下代码在Ubuntu 16.04中安装php5时:

When i try to install php5 in Ubuntu 16.04 by using following code:

sudo apt-get install php5 php5-mcrypt

我收到以下错误:

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

我尝试重新安装,但没有帮助.

I have tried reinstalling but it does not help.

将我的15.10 Ubuntu更新到16.04后遇到了所有此错误

All this error was encountered after I updated my 15.10 Ubuntu to 16.04

推荐答案

Ubuntu 16.04以PHP7为标准,因此没有PHP5软件包

Ubuntu 16.04 comes with PHP7 as the standard, so there are no PHP5 packages

但是,如果您愿意,可以添加PPA以获得这些软件包:

However if you like you can add a PPA to get those packages anyways:

删除所有库存的php软件包

使用dpkg -l | grep php| awk '{print $2}' |tr "\n" " "列出已安装的php软件包,然后使用sudo aptitude清除不需要的软件包,在此处清除your_packages_here,或者如果要直接删除所有软件包,请使用:

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" " "`

添加PPA

sudo add-apt-repository ppa:ondrej/php

安装您的PHP版本

sudo apt-get update
sudo apt-get install php5.6

您也可以安装php5.6模块..

You can install php5.6 modules too ..

验证您的版本

sudo php -v

基于 https://askubuntu.com/a/756186/532957 (感谢@AhmedJerbi)

Based on https://askubuntu.com/a/756186/532957 (thanks @AhmedJerbi)

这篇关于软件包php5没有安装候选版本(Ubuntu 16.04)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆