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

查看:34
本文介绍了软件包 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 列出已安装的 php 包 |grep php|awk '{print $2}' |tr "\n" " " 然后使用 sudo aptitude purge 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天全站免登陆