php pages on localhost try to download instead of render in firefox most of the time

Bug #427190 reported by Tim Wells on 2009-09-10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
php5 (Ubuntu)

Bug Description

I use apache2, php5 and mysql-server to develop web pages on my local machine. I have been using karmic and keeping it up to date since alpha 3.

When viewing pages on localhost (ie. http://localhost/whatever.php) sometimes it will render in firefox and sometimes firefox will ask to download it. While this is annoying and probably serves me right for using alpha versions but I haven't seen this bug report yet.

I can browse any pages on the web with no issues so I can only assume that it is a configuration problem with apache or php or a bug in the current version as it never used to happen on Jaunty.

uname -a:
Linux tim-laptop 2.6.31-10-generic #30-Ubuntu SMP Tue Sep 8 12:32:38 UTC 2009 x86_64 GNU/Linux

apache2 -v:
Server version: Apache/2.2.12 (Ubuntu)
Server built: Aug 18 2009 13:02:39

php -v:
PHP 5.2.10-2ubuntu3 with Suhosin-Patch 0.9.7 (cli) (built: Sep 8 2009 13:35:29)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with Suhosin v0.9.27, Copyright (c) 2007, by SektionEins GmbH

lsb_release -rd:
Description: Ubuntu karmic (development branch)
Release: 9.10

sudo apt-cache policy apache2:
  Installed: 2.2.12-1ubuntu2
  Candidate: 2.2.12-1ubuntu2
  Version table:
 *** 2.2.12-1ubuntu2 0
        500 karmic/main Packages
        100 /var/lib/dpkg/status

sudo apt-cache policy php5:
  Installed: 5.2.10.dfsg.1-2ubuntu3
  Candidate: 5.2.10.dfsg.1-2ubuntu3
  Version table:
 *** 5.2.10.dfsg.1-2ubuntu3 0
        500 karmic/main Packages
        100 /var/lib/dpkg/status

Micah Gersten (micahg) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. This bug did not have a package associated with it, which is important for ensuring that it gets looked at by the proper developers. You can learn more about finding the right package at I have classified this bug as a bug in php5.
For future reference you might be interested to know that a lot of applications have bug reporting functionality built in to them. This can be accessed via the Report a Problem option in the Help menu for the application with which you are having an issue. You can learn more about this feature at

The browser will ask to download the file if it receives no output from the apache server which in turn gets the output from the php script. Please verify that you are returning data from the PHP script.

affects: ubuntu → php5 (Ubuntu)
Changed in php5 (Ubuntu):
status: New → Incomplete
Tim Wells (timnwells) wrote :

I can confirm I get the correct output from the php script 1 third of the times I refresh, the page loads and displays the desired output in the browser. The other times I just get the download popup.

Hash: SHA1

Could you please try outputting the same output to a file as well as
the browser and see if you do indeed get output when the browser
presents the download box?

Tim Wells wrote:
> I can confirm I get the correct output from the php script 1 third
> of the times I refresh, the page loads and displays the desired
> output in the browser. The other times I just get the download
> popup.
Version: GnuPG v1.4.9 (GNU/Linux)


Tim Wells (timnwells) wrote :

okay, tested a script by turning on output buffering, echo a few things including date and time, get the contents of the buffer and write it to a file then flush the buffer to display it to the browser.

When firefox presents the download box it also doesn't write the data into the file, otherwise it writes to the file and outputs to the browser as normal.

It seems to happen a lot less frequently with a simple script like that than it does it with my more complex scripts.

Charlie Powell (powellc) wrote :

This is probably caused from a module loaded from PHP randomly segfaulting. In my experience, it was xdebug that was crashing.

Checkout and see if this is a duplicate from that bug.

Tim Wells (timnwells) wrote :

I thought it might be something segfaulting as well but have already / and again checked the /var/log/messages and with the exception of a couple of unrelated segfaults (nautilus, update-manager, etc) there is nothing in the logfiles about php segfaulting.

Charlie Powell (powellc) wrote :

The segfault is usually listed under the apache log, not the system messages. Check /var/log/apache2/error.log instead.

Tim Wells (timnwells) wrote :

Okay thanks... lots of segfaults in there, but they all say:

[Thu Sep 10 21:19:45 2009] [notice] child pid 14249 exit signal Segmentation fault (11)

with different pid numbers.

Charlie Powell (powellc) wrote :

Bug #424789 is another bug that sounds very similar to this one. Try removing the suhosin patch,
sudo apt-get remove php5-suhosin
sudo /etc/init.d/apache2 restart
and see if your environment keeps randomly crashing. Also, try removing xdebug if you have that (php5-xdebug).

My dev environment kept behaving this exact same way several months back when I was testing php 5.2.9 with suhosin and xdebug on Jaunty. I didn't want to waste any more time on it, so I just reverted back to 5.2.6 that came with the distro, hoping that it would be worked out by the next release... I guess I was wrong.

Tim Wells (timnwells) wrote :

Seems the issue was with that suhosin patch, after removal and restart of apache I haven't had it happen again so far.

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

Other bug subscribers