0
Creating config file /etc/php/7.0/cli/php.ini with new version
Setting up php7.0-fpm (7.0.8-0ubuntu0.16.04.3) ...
Not replacing deleted config file /etc/php/7.0/fpm/php.ini
insserv: warning: script 'K01jira' missing LSB tags and overrides
insserv: warning: script 'nagios' missing LSB tags and overrides
insserv: warning: script 'jira' missing LSB tags and overrides
Job for php7.0-fpm.service failed because the control process exited with error code. See "systemctl status php7.0-fpm.service" and "journalctl -xe" for details.
invoke-rc.d: initscript php7.0-fpm, action "start" failed.
dpkg: error processing package php7.0-fpm (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of php7.0:
 php7.0 depends on php7.0-fpm | libapache2-mod-php7.0 | php7.0-cgi; however:
  Package php7.0-fpm is not configured yet.
  Package libapache2-mod-php7.0 is not installed.
  Package php7.0-cgi is not installed.

dpkg: error processing package php7.0 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of php:
 php depends on php7.0; however:
  Package php7.0 is not configured yet.

dpkg: error processing package php (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates it's a follow-up error from a previous failure.
    No apport report written because the error message indicates it's a follow-up error from a previous failure.
        Errors were encountered while processing:
 php7.0-fpm
 php7.0
 php
E: Sub-process /usr/bin/dpkg returned an error code (1)

I just upgraded from Ubuntu 14.04 to 16.04. Before doing so we completely removed mysql and php with the mindset of installing the new version afterward.

We installed a fresh apache and mysql server with zero issue. But when it comes to php we keep getting stuck with the above warning.

The guide we just followed was https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04

How to resolve this issue and install php?

John
  • 225
  • 1
    Try dpkg --configure -a – sinclair Nov 12 '16 at 14:41
  • @sinclair I flag many questions without hesitations because I'm not a nice guy. Maybe there's a dupe for this a question but I don't think the one you pointed to is the right dupe for this one – Lynob Nov 12 '16 at 14:43
  • 1
    To quote your question: See "systemctl status php7.0-fpm.service" and "journalctl -xe" for details. – What's the output of those? – David Foerster Nov 14 '16 at 02:03

2 Answers2

3

OK I found a solution that worked for me...

cd /var/lib/dpkg/info
rm *.postinst
apt-get --force-yes install openjdk-7-jre-headless

I only assume that as openjdk was already installed that this was just a kick it need not have been openjdk.

I then proceded to purge apache and php

apt-get purge apache2
apt-get purge php
apt-get autoremove
apt-get autoclean
rm -R /etc/apache2 /etc/php

I could then cleanly install apache2 and php once more and everything was happy apt-get install apache2 apt-get install php

What a headache. dpkg --configure -a did nothing and kept saying the initial dependecy error as did every other solution i could find.

John
  • 225
  • Thanks for your solution! I just had a similar problem and removing .postinst and kickstarting apt helped me out! – Der Alex Sep 25 '20 at 10:03
0

I think if you want to install php7 and php7 modules, you have to do sudo apt-get install php7 and sudo apt-get install php7-x. Or php5. Whereas in the article they said sudo apt-get install php and didn't declare the version.

Also check the comment section on the blog, many people have errors and solutions to those errors down there.

Lynob
  • 6,675