----- Original Message ----- 
From: "odbapsvm"

Okay, now I'm totally confused.

When it comes to php does Internet Explorer and
Firefox work differently?

When I type c:\php\myfile.php in internet explorer I don't see the
output of the php file but the entire contents of the php file.

When I type this same thing into the firefox url dialog box,  firefox
changes it to file:///c:/php/myfile.php in the dialog box and displays
nothing.

Any help clearing this up would be appreciated.

Thanks

--------------------------

Hello,
       Your question doesn't relate to your problem?? perhaps.

PHP is not parsed with direct file access. The file must be accessed via 
your server (http) so that the php is 'run'.

Examples -
http://localhost/php/myfile.php
http://localhost/myfile.php
http://127.0.0.1/php/myfile.php
http://127.0.0.1/myfile.php
http://localhost/
http://127.0.0.1/

At least one of these link should work (straight out of this email).

To answer your question -

No and Yes

PHP is not the issue, IE and FF handle files differently irrespective of the 
particular file type as do other browsers.

This is a detailed issue so I will offerer a guide.

There three variables used by browsers to determine what to do with the 
file -

1)File extension ie - .htm .html .png .pdf .exe .zip
2)File mime type sent back from server.
3)File contents such as %PDF or <HTML>

Some browsers use only one to determine what to do and some browsers go on 
to use others if the first test fails to give a result, other browsers us a 
combination.

In your case IE can't see any headers (there are none as it is direct file 
access without a server). IE then looks at the .php and says 'this is not a 
html file type'. Then IE looks at the file and sees that it has no html tags 
and it is not a binary file so it drops the file as a plain text file into 
the browser window.

FF also cannot see headers so it as there are none so it looks at the 
extension and does not have it registered as a HTML file but FF does not 
look at the content of the file so it gives up and does nothing.

To avoid these issues then you must always send the correct headers when 
using php to send non html files ie -
http://mydomain.com/gallery/pictures.php?gallery=01&picture=mypicture.png
http://mydomain.com/downloads/downloader.php?file=latestversion.zip

Hope this helps.

Reply via email to