Apache fails to start

Hi

Apache is failing to start after an update.

Output of dpkg -l libapache2-mod-php5

dpkg -l libapache2-mod-php5 Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==================================-=============================-============-========================================================================== rc libapache2-mod-php5 5.4.36-0+deb7u1 amd64 server-side, HTML-embedded scripting language (Apache 2 module)

Thanks

Status: 
Active

Comments

Howdy -- ah, it looks like mod_php is no longer installed.

Did you happen to enable Apache's threaded "worker" mode recently? If the default prefork mode is removed, it will take mod_php with it, and can cause what you're seeing.

We can determine that with this command:

dpkg -l 'apache*'`

If you don't need the Apache worker mode though, the above can be corrected by either reinstalling mod_php, or by commenting out the lines that are causing the syntax error in the Apache config (we can help with how to reinstall mod_php).

Hi thanks for the response.

This server has just been sitting there running for months I never touch it, as it only has 2 sites on it. (we have 5 other servers pro and gpl running as well). So I don't know other then this stopped working with the last virtualmin update yesterday.

So .If I'm understanding you right,

the mode I use here is FCGId, not mod_php, but if it doesn't cause any security concerns to reinstall mod_php but still use FCGId then I'm happy to do that.

Output of dpkg -l 'apache*

dpkg -l 'apache*' Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Description +++-==================================-=============================-============-========================================================================== un apache (no description available) un apache-common (no description available) un apache-utils (no description available) ii apache2 2.2.22-13+deb7u4 amd64 Apache HTTP Server metapackage un apache2-common (no description available) ii apache2-doc 2.2.22-13+deb7u4 all Apache HTTP Server documentation un apache2-mpm (no description available) un apache2-mpm-event (no description available) un apache2-mpm-itk (no description available) ii apache2-mpm-prefork 2.2.22-13+deb7u4 amd64 Apache HTTP Server - traditional non-threaded model un apache2-mpm-worker (no description available) un apache2-suexec (no description available) ii apache2-suexec-custom 2.2.22-13+deb7u4 amd64 Configurable suexec program for Apache 2 mod_suexec ii apache2-utils 2.2.22-13+deb7u4 amd64 utility programs for webservers ii apache2.2-bin 2.2.22-13+deb7u4 amd64 Apache HTTP Server common binary files ii apache2.2-common 2.2.22-13+deb7u4 amd64 Apache HTTP Server common files

Yeah it looks like it might just be a matter of re-installing mod_php. You can do that with this command:

apt-get install libapache2-mod-php5

Once you do that, are you then able to start Apache?

Hi AndrewChek

I reinstalled as requested and now its up and running again.

Thanks for your time as usual.

BTW any ideas why it stopped working ? (just for future reference).

Thanks Michael

That has worked for me too, Apache's back up; I have no idea why the PHP module was uninstalled though, that doesn't make much sense to me :/

Hmm, that's all very unusual! I'm not sure what might be causing mod_php to be uninstalled.

I can't see any reason why Virtualmin itself would remove that, though I'm do some testing with it, along with other recent Debian/Ubuntu updates, to see if we can reproduce that.

Thanks :) FYI I'm on Debian 7.8, I'm pretty sure the machine started out on 7.7 so I'm not sure if it's recently done an auto update :/

I'm on Deb 7.7

Hello, this was a failure of updating apache thru webmin.

/var/log/apt/history.log ...

Start-Date: 2015-01-10  21:58:19
Commandline: apt-get -y install apache2
Install: apache2-mpm-itk:amd64 (2.2.22-13+deb7u4, automatic)
Upgrade: apache2:amd64 (2.2.22-13+deb7u3, 2.2.22-13+deb7u4), apache2.2-common:amd64 (2.2.22-13+deb7u3, 2.2.22-13+deb7u4), apache2.2-bin:amd64 (2.2.22-13+deb7u3, 2.2.22-13+deb7u4)
Remove: libapache2-mod-php5:amd64 (5.4.36-0+deb7u1), apache2-mpm-prefork:amd64 (2.2.22-13+deb7u3)
End-Date: 2015-01-10  21:58:58

it removes libapache2-mod-php5 but did not install it again.

Regards. Ulrich

Francewhoa's picture
Submitted by Francewhoa on Sat, 08/01/2015 - 21:12

We're confirming this bug with Virtualmin 4.18.gpl

Manually reinstalling "libapache2-mod-php5" package fixed that bug. Thanks to AndrewChek and Ulrich/TheULi for the tip :)

Steps to reproduce that bug

  1. Using Virtualmin update to Apache 2.2
  2. Reboot. Apache will not start. Error message below.

Using

  • Operating system: Debian GNU/Linux 7.8 (Wheezy)
  • Virtualmin: 4.18.gpl
  • Webmin version: 1.760

Below is an extract from Virtualmin message. Notice that "libapache2-mod-php5" is automatically removed while updating to Apache 2.2 thru Virtualmin. And not automatically install again.

The following packages will be REMOVED:
  apache2-mpm-prefork libapache2-mod-php5

Below is the full first part of Virtualmin message

Update Packages

Now updating apache2 ..

Installing package(s) with command apt-get -y install apache2 ..

Reading package lists...
Building dependency tree...
Reading state information...
The following package was automatically installed and is no longer required:
  php-console-table
Use 'apt-get autoremove' to remove it.
The following extra packages will be installed:
  apache2-mpm-itk apache2.2-bin apache2.2-common
The following packages will be REMOVED:
  apache2-mpm-prefork libapache2-mod-php5
The following NEW packages will be installed:
  apache2-mpm-itk
The following packages will be upgraded:
  apache2 apache2.2-bin apache2.2-common
3 upgraded, 1 newly installed, 2 to remove and 3 not upgraded.
Need to get 1089 kB of archives.
[...]

Error message when starting Apache 2.2

Error 

Failed to start service :

Starting web server: apache2Syntax error on line 33 of /etc/apache2/sites-enabled/[***].conf:

Invalid command 'php_admin_value', perhaps misspelled or defined by a module not included in the server configuration

Action 'start' failed.

The Apache error log may have more information.

failed!

Hi Guys

This is still happening with apache updates (2 times in the last month). Will this be looked at or are we doomed to reinstall mod_php each time ?

Thanks Michael

Sorry for the delay, I'm talking to Jamie about how best we can address that issue.

Thanks for looking into this - I had such a panic when I got hit by this again a few weeks ago, and I'd forgotten what the problem was. Turned out to be the same thing when I eventually stumbled on this post again.

I've now documented the problem in my wiki so I can at least remember to try re-installing libapache2-mod-php5 if it happens again.

Francewhoa's picture
Submitted by Francewhoa on Tue, 08/18/2015 - 12:25

Thanks for investigating andreychek and Jamie :)

Subscribed