install of libapache2-mod-php5 may not result in enabled php

Bug #603192 reported by Scott Moser
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apache2 (Ubuntu)

Bug Description

Binary package hint: apache2

On a fresh ec2 instance of maverick i386, I tried:
$ sudo apt-get install libapache2-mod-php5

That went fine, ending with:
| Setting up apache2-mpm-prefork (2.2.15-5ubuntu1) ...
| * Starting web server apache2
| ...done.
| Setting up php5-common (5.3.2-1ubuntu5) ...
| Setting up libapache2-mod-php5 (5.3.2-1ubuntu5) ...
| Creating config file /etc/php5/apache2/php.ini with new version
| * Reloading web server config apache2
| ...done.
| Processing triggers for libc-bin ...
| ldconfig deferred processing now taking place

However, php files were not being processed until a subsequent apache restart (or reload).

I suspect the problem is a race condition in /etc/init.d/apache2.
In this install case, apache is started, and very soon after the configuration is reloaded.

I was able to recreate the failure outside of install by:

$ sudo sh -xc 'service apache2 stop;
  sleep 3;
  a2dismod php5;
  service apache2 start;
  a2enmod php5;
  service apache2 reload;'

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: apache2.2-common 2.2.15-5ubuntu1
ProcVersionSignature: User Name 2.6.32-305.9-ec2
Uname: Linux 2.6.32-305-ec2 i686
Architecture: i386
Date: Thu Jul 8 14:14:22 2010
Ec2AMI: ami-7e5db517
Ec2AMIManifest: ubuntu-images-testing-us/ubuntu-maverick-daily-i386-server-20100706.manifest.xml
Ec2AvailabilityZone: us-east-1b
Ec2InstanceType: m1.small
Ec2Kernel: aki-078e676e
Ec2Ramdisk: unavailable
 PATH=(custom, user)
SourcePackage: apache2

Revision history for this message
Scott Moser (smoser) wrote :
Chuck Short (zulcss)
affects: apache2 (Ubuntu) → php5 (Ubuntu)
affects: php5 (Ubuntu) → apache2 (Ubuntu)
Changed in apache2 (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
importance: Medium → Low
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

I was able to repeat the steps, and agree with your assessment that the "reload" signal is getting delivered before the server has even registered its signal handlers.

I set it to medium, because it might expose the php code of an unsuspecting user until they restart the server.

One workaround would be to restart, rather than force-reload, in libapache2-mod-php5.postinst. Since we're changing the server in quite a fundamental way by loading new modules, this is might be a good idea to do on libapache2-mod-*, as it would leave apache in a much cleaner state, at the expense of maybe interrupting a few connections in massive virtual hosting situations.

Revision history for this message
Andreas Olsson (andol) wrote :

I wonder if this is the explanation to the not necessarily fixed bug #403599?

Chuck Short (zulcss)
affects: apache2 (Ubuntu) → php5 (Ubuntu)
Chuck Short (zulcss)
affects: php5 (Ubuntu) → apache2 (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.