Installing PHP5 performs a reload to apache instead of a restart

Bug #403599 reported by Nandox7
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php5 (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: php5

Seen in Ubuntu 9.04 Jaunty
When installing the PHP5 package I see the following behavior:

------------
Selecting previously deselected package php5.
Unpacking php5 (from .../php5_5.2.6.dfsg.1-3ubuntu4.1_all.deb) ...
Setting up php5-common (5.2.6.dfsg.1-3ubuntu4.1) ...
Setting up libapache2-mod-php5 (5.2.6.dfsg.1-3ubuntu4.1) ...
 * Reloading web server config apache2 [ OK ]

Setting up php5 (5.2.6.dfsg.1-3ubuntu4.1) ...
------------

It install the package and issues a reload, but the reload doesn't load the new configurations for the PHP5 module and makes the usage of PHP impossible unless a manual restart is performed. Also not making it consistent with the removal.
That outpust a warning to the console:
-------------
Module php5 disabled.
Run '/etc/init.d/apache2 restart' to activate new configuration!
-------------

The expected behavior would be to issue a restart or to post an alert to manually perform the restart to the apache service.

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

I can confirm this issue in Karmic and php5 5.2.10.dfsg.1-1ubuntu1. Just not sure if the issue is reload vs. restart.

Doing an extra /etc/init.d/apache2 reload did the trick just as well as a /etc/init.d/apache2 restart.

Changed in php5 (Ubuntu):
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Andreas Olsson (andol) wrote :

Discovered something rather interesting/confusing...

First I did a rebuild of php5, modifying libapache2-mod-php5.postinst to make it abort (exit 1) just before it had time to run its invoke-rc.d apache2 force-reload.

Turned out that after installation the new packages, and having libapache2-mod-php5 abort during postinst, I had to run "invoke-rc.d apache2 force-reload" twice before apache2 would parse php files. If I instead used "invoke-rc.d apache2 restart", then once was enough.

I guess that kind of goes along with my observation in the previous comment. Then there was one reload during the postinst and yet another manually afterwards; still two reloads in other words.

Still, kind of confused by my finding. Why would one reload differ from two reloads?

Would be nice to see if anyone could try to verify my results.

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

There is also the related bug #152410.

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

Noticed a rather significant historical detail...

The construction of using "invoke-rc.d apache2 force-reload" in libapache2-mod-php5.postinst originates from at least back in 2004. At that time (well, actually didn't go further back than Ubuntu 6.06) /etc/init.d/apache2 had force-reload as being equivalent to to restart. Today, at least from Ubuntu 8.04 and forward, /etc/init.d/apache2 has force-reload instead acting as merely a reload. In other words, it seems as the original intent of the packager was to have apache2 restart during the installation of libapache2-mod-php5, an effect which later was lost due to the changing nature of /etc/init.d/apache2.

Also, it seems reasonable to force a restart of apache2 when libapache2-mod-php5 to make sure it's really activated. Hence I'm attachning a debdiff which explicitly tells invoke-rc.d to restart apache2.

That said, we might not want to have apache2 automatically restart at every php5 upgrade, and by that potentially disturbing a live website. Especially not since we've been gracefully reloading now for a while. Hence the debdiff also libapache2-mod-php5.postinst to differ between doing a restart on installation and merely reloading on an upgrade.

Revision history for this message
Nandox7 (nandox7) wrote :

Great effort put on this matter, thanks!

I'll run some tests regarding this.
I find odd the need to use the restart, the reload/force-reload should perform the same action except of course for the immediate killing of all the connections.

Revision history for this message
Chuck Short (zulcss) wrote :

Thanks for the patch however debian does it a bit differently now and we will probably using that for karmic+1.

Regards
chuck

Revision history for this message
Chuck Short (zulcss) wrote :

This should be fixed in lucid now, thanks for the bug report.

Regards
chuck

Changed in php5 (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Andreas Olsson (andol) wrote :

This Debian solution, now being in Lucid, is that the following change from php5 5.2.11.dfsg.1-1?

* add dpkg trigger in the apache2 and apache2filter sapis for reloading
   apache2 on extension updates (Closes: #490023, #524206)

Doing a fresh install of libapache2-mod-php5 5.2.12.dfsg.1-2ubuntu2 I still need to manually do an extra reload of apache2 before it start parsing php code. See also bug #525041.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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