lighttpd forum lighty > Lighttpd, FireFox - tries to download php files

Posted by Simon (Guest)
on 31.08.2008 14:25
Hi,

I'm trying out lighttpd, but have one annoying issue that I can't seem 
to get rid of. I've searched the forums looking for similar issues, but 
not found a satisfactory solution.

The site being used on the server is built using php5 and the problem 
manifests itself consistently when logging in to the account area for 
the first time (per browser session). Instead of loading the account 
page, the FF download box appears asking me whether I want to download 
account.php.

If I cancel the download and try again, it always works correctly. As 
far as I can see from testing, only FF is affected (but can't be 100% 
sure).

It seems to be assigning mime-type correctly, because FF is recognising 
the file as php, not application/octet-stream.

For reference, this is the current lightppd.conf file. Any suggestions 
much appreciated!

#### LOAD MODULES ####

server.modules = ( "mod_access", "mod_accesslog", "mod_fastcgi", 
"mod_rewrite", "mod_redirect", "mod_compress" )

#### GENERAL SETTINGS ####

## server port
server.port = 80

## change uid to <uid> (default: don't care)
server.username = "www-data"

## change uid to <uid> (default: don't care)
server.groupname = "www-data"

## server header
server.tag = "lighttpd"

## default doc root
server.document-root = "/var/www/"

# 404 error file
server.error-handler-404 = "/404.php"

## where to send error-messages to
server.errorlog = "/var/log/lighttpd/error.log"

## pid file
server.pid-file = "/var/run/lighttpd.pid"

## extensions often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

## files to check for
index-file.names = ( "index.php", "index.html", "index.tpl" )

# Use the "Content-Type" extended attribute to obtain mime type if 
possible
mimetype.use-xattr = "enable"

#### MIME-TYPES ####

mimetype.assign  = (
  ".pdf"          =>      "application/pdf",
  ".sig"          =>      "application/pgp-signature",
  ".spl"          =>      "application/futuresplash",
  ".class"        =>      "application/octet-stream",
  ".ps"           =>      "application/postscript",
  ".torrent"      =>      "application/x-bittorrent",
  ".dvi"          =>      "application/x-dvi",
  ".gz"           =>      "application/x-gzip",
  ".pac"          =>      "application/x-ns-proxy-autoconfig",
  ".swf"          =>      "application/x-shockwave-flash",
  ".tar.gz"       =>      "application/x-tgz",
  ".tgz"          =>      "application/x-tgz",
  ".tar"          =>      "application/x-tar",
  ".zip"          =>      "application/zip",
  ".mp3"          =>      "audio/mpeg",
  ".m3u"          =>      "audio/x-mpegurl",
  ".wma"          =>      "audio/x-ms-wma",
  ".wax"          =>      "audio/x-ms-wax",
  ".ogg"          =>      "application/ogg",
  ".wav"          =>      "audio/x-wav",
  ".gif"          =>      "image/gif",
  ".jpg"          =>      "image/jpeg",
  ".jpeg"         =>      "image/jpeg",
  ".png"          =>      "image/png",
  ".xbm"          =>      "image/x-xbitmap",
  ".xpm"          =>      "image/x-xpixmap",
  ".xwd"          =>      "image/x-xwindowdump",
  ".css"          =>      "text/css",
  ".html"         =>      "text/html",
  ".htm"          =>      "text/html",
  ".js"           =>      "text/javascript",
  ".asc"          =>      "text/plain",
  ".c"            =>      "text/plain",
  ".cpp"          =>      "text/plain",
  ".log"          =>      "text/plain",
  ".conf"         =>      "text/plain",
  ".text"         =>      "text/plain",
  ".txt"          =>      "text/plain",
  ".dtd"          =>      "text/xml",
  ".xml"          =>      "text/xml",
  ".mpeg"         =>      "video/mpeg",
  ".mpg"          =>      "video/mpeg",
  ".mov"          =>      "video/quicktime",
  ".qt"           =>      "video/quicktime",
  ".avi"          =>      "video/x-msvideo",
  ".asf"          =>      "video/x-ms-asf",
  ".asx"          =>      "video/x-ms-asf",
  ".wmv"          =>      "video/x-ms-wmv",
  ".bz2"          =>      "application/x-bzip",
  ".tbz"          =>      "application/x-bzip-compressed-tar",
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar"
)

#### MOD ACCESS ####

url.access-deny = ( "~", ".inc", ".tpl" )

#### MOD ACCESSLOG ####

accesslog.filename = "/var/log/lighttpd/access.log"

#### MOD FAST-CGI ####

fastcgi.server = (
	".php" => ((
		"bin-path" => "/usr/bin/php5-cgi",
		"socket" => "/tmp/php.socket",
		"max-procs" => 2,
		"idle-timeout" => 20,
		"bin-environment" => (
			"PHP_FCGI_CHILDREN" => "4",
			"PHP_FCGI_MAX_REQUESTS" => "10000"
		),
		"bin-copy-environment" => (
			"PATH", "SHELL", "USER"
		),
		"broken-scriptfilename" => "enable"
	))
)
Posted by End User (Guest)
on 08.09.2008 15:09
i suspect 2 things.

1. check the doc type declaration, make sure it is full and correct. 
Just out of curiosity is it xhtml 1.1?

2. flush local dns on your machine.

the issue is hard to reproduce, but i suspect it has to do with the 
headers.