Jump to content

PHP firefox issue


slipmatt2002

Recommended Posts

I wonder if anyone can help. I have just designed a website for a client www.dunmar.co.uk. It all works fine in explorer and safari but when I open it in firefox and enter onto the first .php page (www.dunmar.co.uk/index2.php) i keep getting a popup window appear saying:

you have chosen to open index2.php
What should firefox do with this file?
• open with PHP document
• save to disk

and I cant get any further on the website. I am not sure if this is a problem with my PHP but would appreciate any advice. Sorry if this is something really obvious but I am quite new to this.

Thanks
slipmatt2002@yahoo.com
Link to comment
Share on other sites

The headers the web server is returning look like this:

[code]HTTP/1.x 200 OK
Server: Microsoft-IIS/5.0
X-Powered-By: ASP.NET
Date: Wed, 13 Sep 2006 13:34:46 GMT
Content-Type: application/octet-stream
Accept-Ranges: bytes
Last-Modified: Wed, 13 Sep 2006 11:08:59 GMT
Etag: "c0a3f8225d7c61:de8"
Content-Length: 3988
Connection: Keep-Alive[/code]

The problem here is Content-Type: application/octet-stream.  It's a server configuration error that this conent-type is being returned.  Unfortunately I can't help you with fixing it, as I'm not familiar with IIS

Maybe you can fix it by sending header("Content-type: text/html") from your php script.
Link to comment
Share on other sites

Thanks for that, I have checked my PHP and in the head tags it has
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

Not sure if that is what you mean but it is still not working.

It is confusing me because I have set up several sites the same and it just seems to be this one that is causing me trouble, it is hosted by a different company, do you think this could be something to do with it??
Link to comment
Share on other sites

Actually what I meant was this, right at the top of your php file (before ANY html at all, even blank spaces.. otherwise you can't modify the headers)

[code]<?php header("Content-type: text/html") ?>[/code]

If that's not the very first line in your file, it won't work.  You can have some php code before it, but no html.

What that will do is it will modify the headers returned by the server.  This is different from the "meta" http-equiv tags, which tell the browser "Pretend you saw this header instead of the one you really saw" :)

It's possible that firefox is treating the real header (which says your script is an octet stream) as more trustworthy than the meta http-equiv (which says your script is html), but explorer and safari are trusting the http-equiv.  If you can make the real header say "text/html" too, then that might fix it.  Of course IIS might ignore your header() instruction.. but it's worth trying.

Good luck :)

PS What the browser returns after an HTTP request is actually a series of headers (as in my earlier post), followed by the HTML.  Normally you never see those headers, because the browser reads them and interprets them but never displays them.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.