0

when I try to install libapache2-mod-php5 on debian(Linux debian 3.2.0-4-686-pae #1 SMP Debian 3.2.41-2 i686 GNU/Linux) I get the following output:

root@debian:~# apt-get install libapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apache2-bin apache2-data
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  apache2-mpm-prefork apache2.2-bin apache2.2-common
Suggested packages:
  apache2-doc apache2-suexec apache2-suexec-custom
The following packages will be REMOVED:
  apache2
The following NEW packages will be installed:
  apache2-mpm-prefork apache2.2-bin apache2.2-common libapache2-mod-php5
0 upgraded, 4 newly installed, 1 to remove and 274 not upgraded.
Need to get 0 B/3,728 kB of archives.
After this operation, 12.3 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 72217 files and directories currently installed.)
Removing apache2 (2.4.25-3+deb9u3) ...
[ ok ] Stopping Apache htcacheclean: apache-htcacheclean.
[ ok ] Stopping Apache httpd web server: apache2.
Processing triggers for man-db (2.7.6.1-2) ...
(Reading database ... 72168 files and directories currently installed.)
Preparing to unpack .../apache2.2-bin_2.2.22-13+deb7u12_i386.deb ...
Unpacking apache2.2-bin (2.2.22-13+deb7u12) ...
dpkg: error processing archive /var/cache/apt/archives/apache2.2-bin_2.2.22-13+deb7u12_i386.deb (--unpack):
 trying to overwrite '/usr/lib/apache2/modules/mod_rewrite.so', which is also in package apache2-bin 2.4.25-3+deb9u3
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Preparing to unpack .../apache2.2-common_2.2.22-13+deb7u12_i386.deb ...
Unpacking apache2.2-common (2.2.22-13+deb7u12) ...
dpkg: error processing archive /var/cache/apt/archives/apache2.2-common_2.2.22-13+deb7u12_i386.deb (--unpack):
 trying to overwrite '/usr/share/man/man8/apache2.8.gz', which is also in package apache2-bin 2.4.25-3+deb9u3
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Preparing to unpack .../apache2-mpm-prefork_2.2.22-13+deb7u12_i386.deb ...
Unpacking apache2-mpm-prefork (2.2.22-13+deb7u12) ...
dpkg: error processing archive /var/cache/apt/archives/apache2-mpm-prefork_2.2.22-13+deb7u12_i386.deb (--unpack):
 trying to overwrite '/usr/sbin/apache2', which is also in package apache2-bin 2.4.25-3+deb9u3
Selecting previously unselected package libapache2-mod-php5.
Preparing to unpack .../libapache2-mod-php5_5.4.45-0+deb7u14_i386.deb ...
Unpacking libapache2-mod-php5 (5.4.45-0+deb7u14) ...
Processing triggers for man-db (2.7.6.1-2) ...
Errors were encountered while processing:
 /var/cache/apt/archives/apache2.2-bin_2.2.22-13+deb7u12_i386.deb
 /var/cache/apt/archives/apache2.2-common_2.2.22-13+deb7u12_i386.deb
 /var/cache/apt/archives/apache2-mpm-prefork_2.2.22-13+deb7u12_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@debian:~# sudo apt-get purge apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common libapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'apache2-mpm-prefork' is not installed, so not removed
Package 'apache2.2-bin' is not installed, so not removed
Package 'apache2.2-common' is not installed, so not removed
The following packages were automatically installed and are no longer required:
  apache2-bin apache2-data libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  apache2* apache2-utils* libapache2-mod-php5*
0 upgraded, 0 newly installed, 3 to remove and 274 not upgraded.
1 not fully installed or removed.
After this operation, 9,097 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 72174 files and directories currently installed.)
Removing libapache2-mod-php5 (5.4.45-0+deb7u14) ...
Purging configuration files for libapache2-mod-php5 (5.4.45-0+deb7u14) ...
Purging configuration files for apache2 (2.4.25-3+deb9u3) ...
dpkg: warning: while removing apache2, directory '/var/www' not empty so not removed
Removing apache2-utils (2.4.25-3+deb9u3) ...
Processing triggers for man-db (2.7.6.1-2) ...
root@debian:~# apt-get install libapache2-mod-php5
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apache2-bin apache2-data
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common
Suggested packages:
  apache2-doc apache2-suexec apache2-suexec-custom
The following NEW packages will be installed:
  apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common libapache2-mod-php5
0 upgraded, 5 newly installed, 0 to remove and 274 not upgraded.
Need to get 0 B/3,950 kB of archives.
After this operation, 13.2 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 71981 files and directories currently installed.)
Preparing to unpack .../apache2.2-bin_2.2.22-13+deb7u12_i386.deb ...
Unpacking apache2.2-bin (2.2.22-13+deb7u12) ...
dpkg: error processing archive /var/cache/apt/archives/apache2.2-bin_2.2.22-13+deb7u12_i386.deb (--unpack):
 trying to overwrite '/usr/lib/apache2/modules/mod_rewrite.so', which is also in package apache2-bin 2.4.25-3+deb9u3
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Selecting previously unselected package apache2-utils.
Preparing to unpack .../apache2-utils_2.4.25-3+deb9u3_i386.deb ...
Unpacking apache2-utils (2.4.25-3+deb9u3) ...
Preparing to unpack .../apache2.2-common_2.2.22-13+deb7u12_i386.deb ...
Unpacking apache2.2-common (2.2.22-13+deb7u12) ...
dpkg: error processing archive /var/cache/apt/archives/apache2.2-common_2.2.22-13+deb7u12_i386.deb (--unpack):
 trying to overwrite '/usr/share/man/man8/apache2.8.gz', which is also in package apache2-bin 2.4.25-3+deb9u3
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Preparing to unpack .../apache2-mpm-prefork_2.2.22-13+deb7u12_i386.deb ...
Unpacking apache2-mpm-prefork (2.2.22-13+deb7u12) ...
dpkg: error processing archive /var/cache/apt/archives/apache2-mpm-prefork_2.2.22-13+deb7u12_i386.deb (--unpack):
 trying to overwrite '/usr/sbin/apache2', which is also in package apache2-bin 2.4.25-3+deb9u3
Selecting previously unselected package libapache2-mod-php5.
Preparing to unpack .../libapache2-mod-php5_5.4.45-0+deb7u14_i386.deb ...
Unpacking libapache2-mod-php5 (5.4.45-0+deb7u14) ...
Processing triggers for man-db (2.7.6.1-2) ...
Errors were encountered while processing:
 /var/cache/apt/archives/apache2.2-bin_2.2.22-13+deb7u12_i386.deb
 /var/cache/apt/archives/apache2.2-common_2.2.22-13+deb7u12_i386.deb
 /var/cache/apt/archives/apache2-mpm-prefork_2.2.22-13+deb7u12_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

That is if I have apache2 installed before or not.

Any ideas? Thanks in advance!

gabrjan
  • 3,080
  • 9
  • 40
  • 69
  • It seems you are trying to install apache 2.2, while apache 2.4 is already installed. Normally conflicts between packages should be handled automatically, but maybe you see this problem because your system wasn't updated in a long time. I'd try to do `apt-get upgrade` first and then try the installation again. Or did you install apache 2.4 from another source? – Karsten Koop May 30 '18 at 08:08
  • That could be the issue that the system is long overdue for upgrade. Will try it. – gabrjan May 30 '18 at 09:44

1 Answers1

0

You should start by calling apt-get autoremove, as apt tool tells you

The following packages were automatically installed and are no longer required:
  apache2-bin apache2-data
Use 'apt-get autoremove' to remove them.

As your problem seems to come from conflicts between files from different apache version, and more specifically, from an old install no longer used...

dpkg: error processing archive /var/cache/apt/archives/apache2.2-bin_2.2.22-13+deb7u12_i386.deb (--unpack):
 trying to overwrite '/usr/lib/apache2/modules/mod_rewrite.so', which is also in package apache2-bin 2.4.25-3+deb9u3
CimCim
  • 48
  • 5