php5 和 phpmyadmin 未安装

Mad*_*ari 5 php package-management apache2 phpmyadmin software-installation

我已经安装了 mysql、mysql-server、apache2 等等。可能是我安装了一些错误的 PPA 或程序导致了这个问题。基本上,我需要运行本地服务器(例如,对于 WordPress)。所以我需要 localhost/phpmyadmin。不知怎的,本地主机正在工作(它显示它的默认页面),但本地主机/phpmyadmin不工作。

当我尝试时sudo apt-get install phpmyadmin,它给出以下输出

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:

phpmyadmin : Depends: libapache2-mod-php5 but it is not going to be installed or
                       libapache2-mod-php5filter but it is not going to be installed or
                       php5-cgi but it is not going to be installed or
                       php5-fpm but it is not going to be installed or
                       php5 but it is not going to be installed
              Depends: php5-mysql but it is not going to be installed or
                       php5-mysqli but it is not installable or
                       php5-mysqlnd but it is not going to be installed
              Depends: php-gettext but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)

当我尝试时sudo apt-get install php5 libapache2-mod-php5,它给出以下错误

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libapache2-mod-php5 : Depends: php5-common (= 5.5.9+dfsg-1ubuntu4.5) but 5.5.9+dfsg-1ubuntu4.14 is to be installed
                       Recommends: php5-cli but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)

再次,我尝试安装缺少的 phps-common sudo apt-get install php5-commom,它显示 php5-common 已经是最新版本。这是输出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libapache2-mod-php5 : Depends: php5-common (= 5.5.9+dfsg-1ubuntu4.5) but 5.5.9+dfsg-1ubuntu4.14 is to be installed
                       Recommends: php5-cli but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
maddy@maddy-PC:/$ sudo apt-get install php5-common
Reading package lists... Done
Building dependency tree       
Reading state information... Done
php5-common is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
Run Code Online (Sandbox Code Playgroud)

所以,伙计们,我需要你们的帮助来安装 phpmyadmin。

更新 这是一个输出grep -R --include '*.list' '^deb ' /etc/apt

/etc/apt/sources.list:deb cdrom:[Ubuntu 14.04.3 LTS _Trusty Tahr_ - Beta amd64 (20150805)]/ trusty main restricted
/etc/apt/sources.list:deb http://ubuntu.excellmedia.net/archive/ trusty main restricted
/etc/apt/sources.list:deb http://ubuntu.excellmedia.net/archive/ trusty-updates main restricted
/etc/apt/sources.list:deb http://ubuntu.excellmedia.net/archive/ trusty universe
/etc/apt/sources.list:deb http://ubuntu.excellmedia.net/archive/ trusty-updates universe
/etc/apt/sources.list:deb http://ubuntu.excellmedia.net/archive/ trusty multiverse
/etc/apt/sources.list:deb http://ubuntu.excellmedia.net/archive/ trusty-updates multiverse
/etc/apt/sources.list:deb http://ubuntu.excellmedia.net/archive/ trusty-backports main restricted universe multiverse
/etc/apt/sources.list:deb http://ubuntu.excellmedia.net/archive/ trusty-security main restricted
/etc/apt/sources.list:deb http://ubuntu.excellmedia.net/archive/ trusty-security universe
/etc/apt/sources.list:deb http://ubuntu.excellmedia.net/archive/ trusty-security multiverse
/etc/apt/sources.list:deb http://extras.ubuntu.com/ubuntu trusty main
/etc/apt/sources.list:deb http://deb.torproject.org/torproject.org trusty main
/etc/apt/sources.list.d/upubuntu-com-office-trusty.list:deb http://ppa.launchpad.net/upubuntu-com/office/ubuntu trusty main
/etc/apt/sources.list.d/google.list:deb http://dl.google.com/linux/chrome/deb/ stable main
/etc/apt/sources.list.d/webupd8team-sublime-text-3-trusty.list:deb http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu trusty main
/etc/apt/sources.list.d/webupd8team-java-trusty.list:deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
/etc/apt/sources.list.d/google-chrome.list:deb http://dl.google.com/linux/chrome/deb/ stable main
/etc/apt/sources.list.d/cordova-ubuntu-ppa-trusty.list:deb http://ppa.launchpad.net/cordova-ubuntu/ppa/ubuntu trusty main
/etc/apt/sources.list.d/webupd8team-tor-browser-trusty.list:deb http://ppa.launchpad.net/webupd8team/tor-browser/ubuntu trusty main
/etc/apt/sources.list.d/nodesource.list:deb https://deb.nodesource.com/node_5.x trusty main
/etc/apt/sources.list.d/ubuntu-wine-ppa-trusty.list:deb http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu trusty main
Run Code Online (Sandbox Code Playgroud)

和输出apt-cache policy php5-common

php5-common:
  Installed: 5.5.9+dfsg-1ubuntu4.14
  Candidate: 5.5.9+dfsg-1ubuntu4.14
  Version table:
 *** 5.5.9+dfsg-1ubuntu4.14 0
        100 /var/lib/dpkg/status
     5.5.9+dfsg-1ubuntu4.5 0
        500 http://ubuntu.excellmedia.net/archive/ trusty-updates/main amd64 Packages
        500 http://ubuntu.excellmedia.net/archive/ trusty-security/main amd64 Packages
     5.5.9+dfsg-1ubuntu4 0
        500 http://ubuntu.excellmedia.net/archive/ trusty/main amd64 Packages
Run Code Online (Sandbox Code Playgroud)

更新 2这是一个输出aptitude search '?narrow(?installed, !?version(CANDIDATE))'

W: Duplicate sources.list entry http://dl.google.com/linux/chrome/deb/ stable/main amd64 Packages (/var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_main_binary-amd64_Packages)
W: Duplicate sources.list entry http://dl.google.com/linux/chrome/deb/ stable/main i386 Packages (/var/lib/apt/lists/dl.google.com_linux_chrome_deb_dists_stable_main_binary-i386_Packages)
W: You may want to update the package lists to correct these missing files
i   google-chrome-stable            - The web browser from Google               
i   nodejs                          - Node.js event-based server-side javascript
i   oracle-java8-installer          - Oracle Java(TM) Development Kit (JDK) 8   
i   oracle-java8-set-default        - Set Oracle JDK 8 as default Java          
i   tor-browser                     - Tor Browser Bundle                        
Run Code Online (Sandbox Code Playgroud)

Byt*_*der 2

您安装的版本php5-common与您要安装的软件包不兼容。

原因很可能是您添加了 PPA,然后php5-common从中安装了更新版本(可能还有其他软件包),并再次删除或禁用了 PPA。

我们现在必须做的是从包缓存中删除那些“太新”的版本,以防止再次意外重新安装它们,然后将包降级php5-common到官方存储库中可用的版本:

sudo apt-get clean    
sudo apt-get install php5-common=5.5.9+dfsg-1ubuntu4.5
Run Code Online (Sandbox Code Playgroud)

仅当这还不起作用时,才运行以下命令。最后一项与上面相同。

sudo rm -rf /var/lib/apt/lists
sudo apt-get update
sudo apt-get install php5-common=5.5.9+dfsg-1ubuntu4.5
Run Code Online (Sandbox Code Playgroud)