Hướng dẫn php5 6 depends libapache2-mod-php5 6 but it is not going to be installed - php5 6 phụ thuộc vào libapache2-mod-php5 6 nhưng nó sẽ không được cài đặt

Vấn đề của bạn là bạn có một PPA không chính thức đang phá vỡ quy trình cài đặt của bạn. Để khắc phục điều này, hãy chạy các lệnh bên dưới:

sudo add-apt-repository --remove ppa:ondrej/php5-oldstable
sudo add-apt-repository --remove ppa:ondrej/php5

PPA này đang cung cấp một phiên bản PHP khác (cũ) thay vì phiên bản thích hợp mà Ubuntu muốn.

Chạy các lệnh này để thêm các kho lưu trữ bổ sung:

sudo add-apt-repository universe
sudo add-apt-repository multiverse

Bây giờ, chạy:

sudo apt-get update

Thông tin kho lưu trữ của bạn sẽ là Ubuntu chính thức. Cài đặt

sudo add-apt-repository universe
sudo add-apt-repository multiverse
0 bằng lệnh này:

sudo apt-get install libapache2-mod-php5

Lưu ý: Bạn có thể cần phải gỡ cài đặt các gói PHP cũ trước. Yêu cầu: You may need to uninstall the old PHP packages first. Command:

sudo apt-get remove php5 php5-common php5-mysql php5-xmlrpc php5-cgi php5-curl php5-gd php5-cli php5-fpm php-apc php-pear php5-dev php5-imap php5-mcrypt

Bạn không nên thêm PPA trừ khi bạn hoàn toàn cần chúng. Họ có thể phá vỡ nhiều hơn họ giải quyết và có thể gây ra các vấn đề như thế này. Ngoài ra, các PPA không chính thức là các vectơ tấn công cho virus tiềm năng. Trừ khi bạn thực sự cần sử dụng PPA, đừng. They can break more than they solve and can cause problems like this. Also, unofficial PPAs are attack vectors for potential viruses. Unless you really need to use a PPA, don't.

Cố gắng nâng cấp PHP từ 5.3 lên 5.6 bằng cách sử dụng các mục sau:

sudo add-apt-repository ppa:ondrej/php5-5.6
sudo apt-get update
sudo apt-get install php5-common

Khi tôi thử điều này, tôi gặp phải lỗi này và không chắc chắn cách giải quyết:

Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libapache2-mod-php5 : Depends: apache2-api-20120211
                       Depends: apache2 (>= 2.4)
                       Depends: php5-json
 php5-cli : Depends: php5-common (= 5.3.10-1ubuntu3.21) but 5.6.18+dfsg-1+deb.sury.org~precise+1 is to be installed
 php5-common : Breaks: php5-xdebug (< 2.2.2) but 2.1.0-1 is to be installed
 php5-curl : Depends: php5-common (= 5.3.10-1ubuntu3.21) but 5.6.18+dfsg-1+deb.sury.org~precise+1 is to be installed
 php5-gd : Depends: php5-common (= 5.3.10-1ubuntu3.21) but 5.6.18+dfsg-1+deb.sury.org~precise+1 is to be installed
 php5-intl : Depends: php5-common (= 5.3.10-1ubuntu3.21) but 5.6.18+dfsg-1+deb.sury.org~precise+1 is to be installed
 php5-mysqlnd : Depends: php5-common (= 5.3.10-1ubuntu3.21) but 5.6.18+dfsg-1+deb.sury.org~precise+1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Nếu tôi cố gắng trước khi nâng cấp bằng cách thực hiện

sudo add-apt-repository universe
sudo add-apt-repository multiverse
1 thì tôi sẽ gặp lỗi này:

The following packages have unmet dependencies:
 libapache2-mod-php5 : Depends: apache2-api-20120211
                       Depends: apache2 (>= 2.4)
                       Depends: php5-common (= 5.6.18+dfsg-1+deb.sury.org~precise+1) but 5.3.10-1ubuntu3.21 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Nếu tôi thử

sudo add-apt-repository universe
sudo add-apt-repository multiverse
2, tôi sẽ gặp lỗi này:

The following packages have unmet dependencies:
 apache2 : Depends: apache2-bin (= 2.4.16-4+deb.sury.org~precise+4) but it is not going to be installed
           Depends: apache2-utils (>= 2.4)
           Depends: apache2-data (= 2.4.16-4+deb.sury.org~precise+4) but it is not going to be installed
           Conflicts: apache2.2-bin but 2.2.22-1ubuntu1.10 is to be installed
           Conflicts: apache2.2-common but 2.2.22-1ubuntu1.10 is to be installed
 libapache2-mod-php5 : Depends: apache2-api-20120211
                       Depends: php5-common (= 5.6.18+dfsg-1+deb.sury.org~precise+1) but 5.3.10-1ubuntu3.21 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Tôi đã thử làm

sudo add-apt-repository universe
sudo add-apt-repository multiverse
3 như đề xuất, nhưng không giải quyết vấn đề. Thay vào đó, tôi nhận được điều này:

The following extra packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils dh-php5 libedit2 libgd3 libmemcached11 libvpx1 php5-cli php5-common php5-curl php5-dev php5-gd php5-intl php5-json php5-mcrypt php5-memcached php5-mysqlnd php5-xdebug pkg-php-tools
Suggested packages:
  www-browser apache2-doc apache2-suexec-pristine apache2-suexec-custom libgd-tools php5-user-cache dh-make
Recommended packages:
  php5-readline
The following packages will be REMOVED:
  apache2-mpm-prefork apache2.2-bin apache2.2-common
The following NEW packages will be installed:
  apache2-bin apache2-data dh-php5 libgd3 libmemcached11 libvpx1 php5-json pkg-php-tools
The following packages will be upgraded:
  apache2 apache2-utils libedit2 php5-cli php5-common php5-curl php5-dev php5-gd php5-intl php5-mcrypt php5-memcached php5-mysqlnd php5-xdebug
13 upgraded, 8 newly installed, 3 to remove and 10 not upgraded.
8 not fully installed or removed.
Need to get 0 B/7,060 kB of archives.
After this operation, 3,685 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 149017 files and directories currently installed.)
Unpacking apache2-bin (from .../apache2-bin_2.4.16-4+deb.sury.org~precise+4_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/apache2-bin_2.4.16-4+deb.sury.org~precise+4_amd64.deb (--unpack):
 trying to overwrite '/usr/share/man/man8/apache2.8.gz', which is also in package apache2.2-common 2.2.22-1ubuntu1.10
dpkg-deb (subprocess): subprocess data was killed by signal (Broken pipe)
dpkg-deb: error: subprocess  returned error exit status 2
Processing triggers for man-db ...
Errors were encountered while processing:
 /var/cache/apt/archives/apache2-bin_2.4.16-4+deb.sury.org~precise+4_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Cũng đã thử làm chỉ

sudo add-apt-repository universe
sudo add-apt-repository multiverse
4 nhưng về cơ bản nhận được cùng một lỗi.

Cách chính xác để giải quyết các vấn đề phụ thuộc này là gì?