Forum Moderators: phranque

Message Too Old, No Replies

XAMPP problem with PHP scripting

PHP works when viewed with IE6/7 but not FF2!

         

steve

4:00 pm on Mar 30, 2007 (gmt 0)

10+ Year Member



I've installed XAMPP on a USB stick. It's version 1.6.0a with Apache 2.2.4 on 127.0.0.2:8080 (to avoid conflict with IIS) and PHP 5.2.1

I've tried the installation on two PC's both running XP Pro, with Windows firewall turned off and ZoneAlarm active.

One machine has IE6, the other IE7, both have FF2.0.0.3. PHP pages work fine in IE but show the source when viewed in FF (websites on the net render correctly).

I've tried disabling ZoneAlarm but this doesn't help.

I'm not sure where the problem is, is it FF, the OS or firewall?

Has anyone had a similar problem, or any suggestions how to diagnose where it is?

Steve

steve

5:02 pm on Mar 30, 2007 (gmt 0)

10+ Year Member



A little more info.

Page response is 200

The first few lines of source code which is displayed are:

Server: Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.1
X-Powered-By: PHP/5.2.1
Keep-Alive: timeout=5, max=100
Content-Type: text/html
Transfer-encoding: chunked

jdMorgan

5:21 pm on Mar 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use the "Live HTTP Headers" extension to Firefox to view the server response headers for your pages. I strongly suspect that you will find that the MIME-type given in the "Content-Type" response header is incorrect. It should be "text/html" if the output of your script is an HTML page, and NOT application/x-httpd-php or anything like that with "php" in it.

Most of the PHP setup example code on the Web confuses the Apache AddHeader and AddType directives. This is because an odd work-around was used when PHP was introduced, and its effects continue to this day.

[added] After seeing your second post, you might also have a content-encoding problem. Since I haven't had any PHP configuration problems myself, I will defer to the experts over in the WebmasterWorld PHP forum [webmasterworld.com]. Also, check out the PHP forum Library for several "How to install PHP" tutorials. [/added]

Jim

steve

3:13 pm on Mar 31, 2007 (gmt 0)

10+ Year Member



Thanks for the suggestions Jim.

I now think the problem is within Apache.

I created a simple html page, "testing.html":

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>Testing</title>
</head>
<body>
<h1>My test page</h1>
<p>Testing 1 2 3</p>
</body>
</html>

Which works fine in IE, but displays in FF as:

Server: Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.1 Last-Modified: Sat, 31 Mar 2007 14:55:02 GMT ETag: "1dd7320-113-2c359d80" Accept-Ranges: bytes Keep-Alive: timeout=5, max=100 Content-Type: text/html Transfer-encoding: chunked 69 fb
My test page

Testing 1 2 3
e 0

The live headers plug-in shows:

http://127.0.0.2:8080/testing.htm

GET /testing.htm HTTP/1.1
Host: 127.0.0.2:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
If-Modified-Since: Sat, 31 Mar 2007 14:55:02 GMT
If-None-Match: "1dd7320-113-2c359d80"
Cache-Control: max-age=0

HTTP/1.x 304 Not Modified
Date: Sat, 31 Mar 2007 14:58:34 GMT
Server: Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.1
Connection: Keep-Alive
Keep-Alive: timeout=5, max=100
Etag: "1dd7320-113-2c359d80"
----------------------------------------------------------
http://127.0.0.1:1027/js.cgi?a&r=900

GET /js.cgi?a&r=900 HTTP/1.1
Host: 127.0.0.1:1027
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Accept: */*
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://127.0.0.2:8080/testing.htm
Cache-Control: max-age=0

HTTP/1.x 200 OK
Connection: close
Content-Type: application/x-javascript
----------------------------------------------------------

The javascipt is inserted by ZoneAlarm.

I don't fully understand headers, is there a problem with these?

Steve

coopster

3:21 pm on Mar 31, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



HTTP/1.x 304 Not Modified

It's pulling the page from the browser's cache. Try clearing the cache in Firefox and see if you can get the page now.

steve

7:58 pm on Mar 31, 2007 (gmt 0)

10+ Year Member



I cleared the cache and reloaded, the page still doesn't display correctly.

The headers are as follows:

http://127.0.0.2:8080/favicon.ico

GET /favicon.ico HTTP/1.1
Host: 127.0.0.2:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Accept: image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive

HTTP/1.x 200 OK
Date: Sat, 31 Mar 2007 19:53:44 GMT
Server: Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.1
Last-Modified: Tue, 08 Nov 2005 13:17:02 GMT
Etag: "1dd71e0-547e-96596f80"
Accept-Ranges: bytes
Keep-Alive: timeout=5, max=100
Content-Type: image/x-icon
Transfer-Encoding: chunked
----------------------------------------------------------
http://127.0.0.2:8080/testing.htm

GET /testing.htm HTTP/1.1
Host: 127.0.0.2:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Cache-Control: max-age=0

HTTP/1.x 200 OK
----------------------------------------------------------
http://127.0.0.1:1027/js.cgi?a&r=18538

GET /js.cgi?a&r=18538 HTTP/1.1
Host: 127.0.0.1:1027
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Accept: */*
Accept-Language: en-gb,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://127.0.0.2:8080/testing.htm

HTTP/1.x 200 OK
Connection: close
Content-Type: application/x-javascript
----------------------------------------------------------

steve

12:43 pm on Apr 2, 2007 (gmt 0)

10+ Year Member



Thank you for the suggestions and advice.

I decided to download and install Opera to see if the problem was specific to FF. It was, so I've posted in the FF forum.

With hindsight I should have done this earlier :-)

Steve

robertsdoug

9:29 pm on Apr 10, 2007 (gmt 0)

10+ Year Member



It is because IE is a better browser than that old smelly fox. :)