Installing PHP doesn't restart Apache2 by default, needs manual restart

Bug #152410 reported by hasan
8
Affects Status Importance Assigned to Milestone
php5 (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: php5

After installing the LAMP package, and I tried to test any php pages, my browser prompted me to download the php file rather than display it because the php module is not enabled. I think it should be enabled by default.

This requires apache2 to restart itself after installing libapache-mod-php5 (installed as a dependency for php5). As this is not done automatically, the module is not loaded by default and hence PHP scripts can be executed.

WORKAROUND:

on a terminal, issue "sudo invoke-rc.d apache2 restart" #if using Apache V2.x)

Revision history for this message
Mathias Gug (mathiaz) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

How did you install the LAMP package ?

Can you check that php5 is listed in /etc/apache2/mods-enabled/ ?

Changed in php5:
status: New → Incomplete
Revision history for this message
hasan (hassanidin) wrote :

I installed it by
Edit -> Mark package by task -> LAMP

It is listed in the directory:
$ ls /etc/apache2/mods-enabled/ | grep php
php5.conf
php5.load

However, whenever I try to navigate to a *.php file, it offers to open the file, rather than display it in the browser.

Revision history for this message
Ondřej Surý (ondrej) wrote :

Did you restarted apache after installing php module?

Revision history for this message
hasan (hassanidin) wrote :

Restarting fixed the problem.
But shouldn't it be working right after installation?

Revision history for this message
Ondřej Surý (ondrej) wrote :

No, it shouldn't. php should not automaticaly restart apache without administrator (ie. just by installing). It could lead to apache not starting because broken configuration, etc.

Revision history for this message
hasan (hassanidin) wrote :

Thanks for the clarification.
I assumed that after installing LAMP everything would be in a working state.

Revision history for this message
Soren Hansen (soren) wrote :

This is not a duplicate of bug #104270. Installing libapache2-mod-php5 should indeed restart apache (after checking that apache's config isn't broken) and that is indeed what the current postinst is meant to do.

hasan, I don't understand what "Edit -> Mark package by task -> LAMP" means. Does that mean you chose it during installation?

Revision history for this message
hasan (hassanidin) wrote :

I had an Ubuntu Desktop installed, and I installed the LAMP package on top of that in Synaptic by using the "Mark package by task" option in the Edit menu.

Revision history for this message
Muhammad Takdir (muhammad-takdir) wrote :

i do like this and it's work,

sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql
sudo /etc/init.d/apache2 restart
sudo apt-get install mysql-server

Revision history for this message
Parthan SR (parth-technofreak) wrote :

Confirming on
  Feisty (apache2 version 2.2.3-3.2ubuntu2.1),
  Gutsy and,
  Hardy (apache2 version 2.2.8-1ubuntu0.3),
that apache2 doesn't restart after installing libapache2-mod-php5.

Revision history for this message
Parthan SR (parth-technofreak) wrote :

Missed version detail on php5,

  Feisty: php5-5.2.1-0ubuntu1.5
  Hardy: php5-5.2.4-2ubuntu5.2

HTH :)

description: updated
Revision history for this message
C de-Avillez (hggdh2) wrote :

Marking as triaged, per Soren's comments. Seems to affect Fesity, Gustsy, and Hardy, at least. Might also affect Intrepid (not tested)

Changed in php5:
status: Incomplete → Triaged
description: updated
description: updated
Revision history for this message
mikael henrikson (mikael-henrikson) wrote :

Intrepid: After installing LAMP, rebooting and restarting the Apache PHP is not running. Same symptoms as the top post. Any idea how I can start it?
thanks

Revision history for this message
mikael henrikson (mikael-henrikson) wrote :

correction (Intrepid):
PHP is not working on: http://localhost
but is IS working on: http://127.0.0.1
/m

Revision history for this message
Muhammad Takdir (muhammad-takdir) wrote :

may I see your's /etc/hosts file ?

Revision history for this message
mikael henrikson (mikael-henrikson) wrote :

attached.
/m

Revision history for this message
Muhammad Takdir (muhammad-takdir) wrote :

your hosts is ok, try to write like this on your browser :
with / at the end

http://localhost/

Revision history for this message
mikael henrikson (mikael-henrikson) wrote :

some strange behaviour today; computer has been shut off for a few hours.

http://localhost -> redirects to http://localhost/
http://localhost/ -> ok (no php)
http://localhost/wordpress/ (incl php) -> redirects to http://127.0.0.1/wordpress/ -> php ok

I'm not sure what is happening but I guess I'm ok with functionality and I'm sure this could be due to a lot of updates etc. I will re-check in future clean installs of Intrepid.

Daniel Hahler (blueyed)
Changed in php5:
importance: Undecided → Low
Revision history for this message
Andreas Olsson (andol) wrote :

Discovered this thread after having started working on bug #403599. While they deal with the same issue, I'm not sure which report is the proper one to base of, considering the Apache2 and PHP2 packages might have changed somewhat since this report originated.

No matter what I still wanted to tie the reports together somehow.

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

As bug #403599 is now Fixed, the same goes for this report.

Changed in php5 (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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