Trying to do a lamp install I get this error:

$ sudo apt-get install libapache2-mod-php7.0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libapache2-mod-php7.0 is already the newest version (7.0.15-0ubuntu0.16.04.4).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up libapache2-mod-php7.0 (7.0.15-0ubuntu0.16.04.4) ...
dpkg: error processing package libapache2-mod-php7.0 (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)
  • please add more information as per how you went about, cause as I see it from your command it says to me I have installed php7, and when trying to install "libapache2-mod-php7.0 module" I get an error... SO it's either you are trying to install the module first before php7 or you have and are getting errors with installing the module in question – George Udosen Mar 4 '17 at 8:28
  • There is "1 not fully installed or removed." So, try with sudo apt install -f to fix broken, after that sudo apt update && sudo apt upgrade, and then try again sudo apt install libapache2-mod-php7.0. – pa4080 Mar 4 '17 at 18:35
  • 1
    Full command was as follows: $ sudo apt-get install php7.0 php7.0-mysql libapache2-mod-php7.0 php7.0-cli php7.0-cgi php7.0-gd – Edward Danilyuk Mar 4 '17 at 18:37
  • 3
    Also you can to purge this package ant try to install it again: sudo apt purge libapache2-mod-php7.0. – pa4080 Mar 4 '17 at 18:46
  • 1
    Spas: apt purge and install did the trick. Thank you! – Edward Danilyuk Mar 4 '17 at 18:57

As mentioned in this comment

sudo apt purge libapache2-mod-php7.0

worked for me too.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.