E: PHP를 업데이트할 때 하위 프로세스 /usr/bin/dpkg가 오류 코드(1)를 반환합니다.

E: PHP를 업데이트할 때 하위 프로세스 /usr/bin/dpkg가 오류 코드(1)를 반환합니다.

php를 php5로 업데이트하려고 하는데 다음 오류가 발생합니다.

root@Ansible-VirtualBox:~# apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following package was automatically installed and is no longer required:
  libbsd0
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils libedit2 libgd3 libvpx1
  php5-cli php5-common php5-gd php5-json
Suggested packages:
  apache2-doc apache2-suexec-pristine apache2-suexec-custom libgd-tools
  php-pear php5-user-cache
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 libgd3 libvpx1 php5-json
The following packages will be upgraded:
  apache2 apache2-utils libedit2 php5-cli php5-common php5-gd
6 upgraded, 5 newly installed, 3 to remove and 6 not upgraded.
1 not fully installed or removed.
Need to get 0 B/5,489 kB of archives.
After this operation, 2,659 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 177484 files and directories currently installed.)
Unpacking apache2-bin (from .../apache2-bin_2.4.17-2+deb.sury.org~precise+1_i386.deb) ...
dpkg: error processing /var/cache/apt/archives/apache2-bin_2.4.17-2+deb.sury.org~precise+1_i386.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 <decompress> returned error exit status 2
Processing triggers for man-db ...
Errors were encountered while processing:
 /var/cache/apt/archives/apache2-bin_2.4.17-2+deb.sury.org~precise+1_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

이전에 설치된 버전과 패키지를 제거하려고 하면 다음 오류가 발생합니다.

root@Ansible-VirtualBox:~# apt-get remove apache2
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-common (= 5.5.30+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).
root@Ansible-VirtualBox:~# apt-get remove apache2.2-bin
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:
 apache2-mpm-prefork : Depends: apache2.2-bin (= 2.2.22-1ubuntu1.10) but it is not going to be installed
 apache2.2-common : Depends: apache2.2-bin (= 2.2.22-1ubuntu1.10) but it is not going to be installed
 libapache2-mod-php5 : Depends: apache2-api-20120211
                       Depends: apache2 (>= 2.4)
                       Depends: php5-common (= 5.5.30+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).
root@Ansible-VirtualBox:~# apt-get remove apache2-
apache2-mpm-prefork  apache2-utils        
root@Ansible-VirtualBox:~# apt-get remove apache2
apache2              apache2.2-bin        apache2.2-common     apache2-mpm-prefork  apache2-utils
root@Ansible-VirtualBox:~# apt-get remove apache2.2-common
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:
 apache2 : Depends: apache2.2-common (= 2.2.22-1ubuntu1.10) but it is not going to be installed
 apache2-mpm-prefork : Depends: apache2.2-common (= 2.2.22-1ubuntu1.10) but it is not going to be installed
 libapache2-mod-php5 : Depends: apache2-api-20120211
                       Depends: apache2 (>= 2.4)
                       Depends: php5-common (= 5.5.30+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).

답변1

이유를 찾았습니다.

dpkg: error processing /var/cache/apt/archives/apache2-bin_2.4.17-2+deb.sury.org-precise+1_i386.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

당신은 분명히(!!) apache버전이 동시에(또는 "단지" 두 개만 설치됨)노력하다세 번째 추가): v2.2.22, v2.4.17 및 v2.8. 이는 전혀 권장되지 않습니다.오류나 서버 장애가 발생하기 쉽습니다.!

엄격하게 준수해야 합니다하나세 가지 버전에는 apache제거나머지 모든 Apache 버전(예: Ubuntu Precise Pangolin의 2.2.22 및 2.4.17):

$ sudo apt-get remove <name of previous package(s)>

(입력 apa한 다음 Tab키를 사용하여 올바른 패키지 이름을 선택해 보십시오)

귀하의 시스템은 이러한 이상한 버전으로 인해 복잡해졌습니다 apache.

관련 정보