Page 2 of 3

Posted: Wed Dec 15, 2004 1:12 am
by victor
seems like i misinterpreted the characteristics of the local server, the page aren't cached at all despite no headers being sent, nothing was printed pertaining to the headers sent on the local servers.

as for the remote server, the page does take an awfully long time to lo

attached is my code for the page, see if there's any thing wrong with it.

Code: Select all

<?php
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);
header('Pragma: no-cache');
session_start();

$url = 'http://mywebsite.www/form.php';
$fp = fopen($url, 'r');
print_r($http_response_header);


if(isset($_SESSION['enq_array']))
unset($_SESSION['enq_array']);

require_once('../user_sc_fns.php');

display_enq_form();

?>

Posted: Wed Dec 15, 2004 1:49 am
by victor
the file cannot be opened, adding condition if returns a false.

php]<?php
$url = 'http://localhost/form.php';

if($fp = fopen($url, 'r'))
echo'file opened';
else
echo'file not opened';[
?>

Posted: Wed Dec 15, 2004 2:05 am
by rehfeld
theres no need to put the code i gave you in w/ your other code.

in fact, thats why it takes so long to load, you created an infinite loop


put that code in its own file and run it.

r u using dial up or not?

Posted: Wed Dec 15, 2004 2:38 am
by victor
i'm using dsl broadband connection, i managed to obtain the following from the internet server:

Code: Select all

Array ( &#1111;0] => HTTP/1.1 200 OK &#1111;1] => Date: Wed, 15 Dec 2004 08:28:56 GMT &#1111;2] => Server: Apache &#1111;3] => Cache-Control: post-check=0, pre-check=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0 &#1111;4] => Expires: Thu, 19 Nov 1981 08:52:00 GMT &#1111;5] => Pragma: no-cache &#1111;6] => Set-Cookie: PHPSESSID=e8b93b5426ffa66d75e63ec3d951cd23; path=/ &#1111;7] => Last-Modified: Wed, 15 Dec 2004 08:28:56 GMT &#1111;8] => Vary: Accept-Encoding,User-Agent &#1111;9] => Connection: close &#1111;10] => Content-Type: text/html )
the local server test produce the following error:

Code: Select all

Warning: fopen(): URL file-access is disabled in the server configuration in C:\Program Files\Apache
how to enable it?

Posted: Wed Dec 15, 2004 12:06 pm
by rehfeld
in php.ini

there should be something that sais allow url fopen or something similar. enable it


then run that script on the local server and fetch the headers both the local url and the internet url

Posted: Wed Dec 15, 2004 6:05 pm
by victor
my local server produces these headers:

Code: Select all

Array ( &#1111;0] => HTTP/1.1 200 OK &#1111;1] => Date: Thu, 16 Dec 2004 00:00:41 GMT &#1111;2] => Server: Apache/1.3.29 (Win32) &#1111;3] => Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 &#1111;4] => Expires: Mon, 26 Jul 1997 05:00:00 GMT &#1111;5] => Pragma: no-cache &#1111;6] => X-Powered-By: PHP/4.3.4 &#1111;7] => Set-Cookie: PHPSESSID=c0a83aad4f4aa2c50c04a966907fba62; path=/ &#1111;8] => Last-Modified: Thu, 16 Dec 2004 00:00:41 GMT &#1111;9] => Connection: close &#1111;10] => Content-Type: text/html )
have u come across this article? could it be the cause?

http://www.phpbuilder.com/tips/item.php?id=123

Posted: Wed Dec 15, 2004 6:27 pm
by rehfeld
so your saying the headers sent from your local server and your internet server are identical?

if you dont know, you need to find out. ive showed you how.

Posted: Wed Dec 22, 2004 3:04 am
by victor
Just an update:

Caching is not happening in Netscape(web site works perfectly fine), but is happening in IE 6 (in two different client's browser). Both shows the same headers:

Header shown on IE browser:

Code: Select all

HTTP/1.1 200 OK
Date: Wed, 22 Dec 2004 08:15:47 GMT
Server: Apache
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=759c11561eb2d3de4950ab9c262d873d; path=/
Vary: Accept-Encoding,User-Agent
Connection: close
Content-Type: text/html

Header shown on Netscape browser:

Code: Select all

HTTP/1.1 200 OK
Date: Wed, 22 Dec 2004 08:59:02 GMT
Server: Apache
Cache-Control: post-check=0, pre-check=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0, post-check=0, pre-check=0
Pragma: no-cache
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Set-Cookie: PHPSESSID=567db44df8ebc7c24b964ce4a33ef65f; path=/
Last-Modified: Wed, 22 Dec 2004 08:59:03 GMT
Vary: Accept-Encoding,User-Agent
Connection: close
Content-Type: text/html
Any ideas? any help is appreciated

Posted: Wed Dec 22, 2004 3:10 am
by victor
sorry, headers for IE

Code: Select all

HTTP/1.1 200 OK
Date: Wed, 22 Dec 2004 09:08:58 GMT
Server: Apache
Cache-Control: post-check=0, pre-check=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0, post-check=0, pre-check=0
Pragma: no-cache
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Set-Cookie: PHPSESSID=e0f83893a6c5fe2507c6d9e52ce9e1c3; path=/
Last-Modified: Wed, 22 Dec 2004 09:08:58 GMT
Vary: Accept-Encoding,User-Agent
Connection: close
Content-Type: text/html

Posted: Wed Dec 22, 2004 2:04 pm
by rehfeld
in ie,

goto tools>internet options>settings

and tell us what your settings are.

Posted: Wed Dec 22, 2004 8:50 pm
by victor
check for new version of stored pages : automatically

does that suffice?

Posted: Wed Dec 22, 2004 8:56 pm
by rehfeld
yeah thats what it should be.


are you SURE it caching the page?

on the page w/ your form, do this

Code: Select all

echo uniqid();
then submit the form, and then press the backbutton.


if the uniqid is the same, the page is cached. if it changes, the page is not cached, and the form issues are prob just another one of those neat ie "features" they put in.

Posted: Wed Dec 22, 2004 9:14 pm
by victor
As expected same lah. Anything to do w the internet server's setting ? cos the page works fine on my local server using IE 6/Apache 1.3 and Netsscape also.

Posted: Wed Dec 22, 2004 9:55 pm
by rehfeld
is it just your browser? have you had other people using ie try it?

have you checked for known ie bugs for your version of IE for your o/s?

sounds like a bug to me.

check for known bugs for your server version as well.

you know, try one more thing first....


put a copy of this on BOTH your local server and your other one. then goto the urls using ie, and post the results for both of them here. please make sure you post the results in a way so they are formatted and easy to read.

do NOT mix this code in w/ your other stuff. run this code as a standalone script.

Code: Select all

<?php

echo '<pre>';

print_r(apache_request_headers());

print_r(apache_response_headers());

?>
btw- it would help if you posted a url so people could take a look. anyone who might possibly be willing to try a hunch prob isnt going to go through the effort of asking you for the url.

Posted: Wed Dec 22, 2004 10:41 pm
by victor
I got this from both servers

Code: Select all

Fatal error:  Call to undefined function apache_request_headers() in server_response_test.php on line 4