EASYPHP 1.8 based PHP script on Apache and IE 6 - end-to-end system is periodically cacheing XML files read by script

I installed the latest version EasyPHP (Version 1.8) and developed a small application in PHP.
It is running on EASYPHP's Apache 1.3.33.
It needs to be used with Internet Explorer (Version 6) due to a component it uses.

The PHP program parses a specific XML file (say 321.xml) generated by another application with content periodically re-written by the generating application.

The PHP program is launched as follows:

where is replaced by the actual IP address or domain name, and
the XML file name to be processed is 321 (in this example) - actually 321.xml

The PHP script accesses and parses the correct XML file, however often the system "fixates" on an old XML file's content - as if there was caching taking place somewhere in the system.
Equally puzzling, at times the system suddenly starts processing the fresh/current (up-to-date/correct) XML file content.

Tried entering

      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <meta http-equiv="refresh" content="3">
      <META HTTP-EQUIV="Expires" CONTENT="-1">
      <META HTTP-EQUIV="Pragma" CONTENT="no-cache">

into the PHP file and edited the httpd.conf Apache file to prevent caching, but it does not seem to help.
Perhaps I missed something which still allows caching of the XML file.

a) Would appreciate advice on how to handle this - or at least how to approach debugging the problem

b) Does anyone know what is the difference between the "httpd.conf" in
      C:\Program Files\EasyPHP1-8\conf_files
and      C:\Program Files\EasyPHP1-8\apache\conf

c) Can TELNET, Apache log file or other tool be used to view the "response headers" and actual XML file content transmitted to the browser by the server - for debugging this type of problem? If so then how?

Thank you for the help
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richard QuadlingSenior Software DeveloperCommented:
Hi pfefferl,


$s_append = microtime(True);

echo <<< SOME_HTML
<meta http-equiv="refresh" content="3;url=./{$_SERVER['PHP_SELF']}?F={$_GET['F']}&time=$s_append">

sort of thing.


Richard Quadling.
pfefferlAuthor Commented:
Dear Richard,
a) what is the effect of above code?
Richard QuadlingSenior Software DeveloperCommented:
To supply a seemingly random parameter to the request. This will stop the browser from getting the same data as the URL is different.


url = myapp.php?F=123


url = myapp?F=123&12345
url = myapp?F=123&12346
url = myapp?F=123&12347
url = myapp?F=123&12348
url = myapp?F=123&12349

The value is junk, but is different every microsecond.
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

pfefferlAuthor Commented:
Thanks. I can see how this prevents getting the same Web page.

Does this also prevent reading a cached XML file?

The file name is passed to the PHP script via something like

where 321 is the XML file prefix and is pased to the PHP script. The actual XML file is read via
within the script
Richard QuadlingSenior Software DeveloperCommented:
The content of the http request is irrelevant.


Hold on.

Are you saying that when the user (or their browser) makes the request, you eventually get a parameter which contains ''


are you looking at $_GET['F']  to get the name of the file?

If the first one, then you will need to strip off everthing from & onwards.

I'm a PHP ZCE, so you can talk PHP if you want.

Though you would be better off talking in the PHP section -> http://www.experts-exchange.com/Web/Web_Languages/PHP/
pfefferlAuthor Commented:
Dear Richard,

The script is launched by an address string (URL & prameters) such as
and the XML file name prefix (e.g. 321) is obtained via $_GET['ID']

The correct XML file IS opened by the PHP script.
The only problem is that sometimes, for extended periods, the cached content is obtained.
I thought that the Apache cache disabling parameters in httpd.conf will prevent this, but apparently there is still some caching.

Added note. The PHP file/Web page 
is refreshed every few seconds and polls for new content in the XML file.

If I change the "address string" to

RE: PHP talk --- I am experienced programmer in many languages, but am more or les a novice in PHP .... (for now)

pfefferlAuthor Commented:

If I change the "address string" to
where xxxx is a random string, would that prevent the XML file caching?

Richard QuadlingSenior Software DeveloperCommented:

The entire URL is used for caching.
pfefferlAuthor Commented:
Just to be sure I understand:
adding a random string to the tail end of the URL will also prevent reading cached content by xmlDoc.load(.....)?
Richard QuadlingSenior Software DeveloperCommented:
Be careful, the random string applies to the browser not looking at its cache for a copy of a previous request.

If the PHP script then goes and gets more data from somewhere, this is the place where the issue lies.

You've made me wonder where the issue is.

What is the full request for the browser?

Can you show the script you are using to run this?
pfefferlAuthor Commented:
Full request for the browser:

I'll try to smiplify the PHP file and send it. It is a mix of HTML, PHP and Javascriot and the XML fle is loaded via
loadStatus = xmlDoc.load(filename)
pfefferlAuthor Commented:
--- Continbued ---
.. which is a Javascript command

Richard QuadlingSenior Software DeveloperCommented:
Ah. So the issue is in the JavaScript XML loader!!!!

Sort of AJAX.
Richard QuadlingSenior Software DeveloperCommented:
So the request from the xmlDoc.load with the filename containing the random additional parameter ...

Will be a unique request each time.

The issue is getting the browser to get the new random string each time.

You MAY be better off using the browser to construct the random element rather than supplying it.

If the browser IS cacheing, the page will make the same request via xmlDoc.load()!

You could use a javascript timer to do the refresh, saving a round trip for the entire page which only really wants the XML data updated.

Obviously, you will need client side JS to clear the display and redraw the new XML data as appropriate, so maybe not saving anything in effort.
pfefferlAuthor Commented:
a) What is "AJAX"?

b) currently xmlDoc.load gets a parameter like
   or IP address qualifierd as

and NOT

    The xmlDoc.load sems to be related to the caching problem.
    I suspect, but can't as yet tell, that this may be due to the Apache server

c) "If the browser IS cacheing, the page will make the same request via xmlDoc.load()!"
   REquesting the same FILE NAME should not be a problem, in fact it must be so.
   Only the file CONTENT changes

d) Using the Javascript timer may be a good idea - I'll look intio that
Richard QuadlingSenior Software DeveloperCommented:
Where does you myapp.php come into it then?
Richard QuadlingSenior Software DeveloperCommented:
AJAX = Asynchronous JavaScript with XML.

Also known as Web V2.0

It is the new way of writing web apps where there is no page refreshing, just a constant communication between the browser and the server behind the scenese and the browser updating the page in real time. Automatically.

Very nice tech.

Like a GUI is in real time - the code can say change this button to disabled because a DB value says so.

Currently you would have to do a refresh to get a new page.

With AJAX the communication says that the button is disabled, so the browser makes it so.

AJAX is a concept, not a library of code.

AJAX has been implemented in MANY languages.

Do a gogle.
pfefferlAuthor Commented:
a) Thanks for AJAX info. Will look into it

b) "Where does you myapp.php come into it then?"
It issues the  xmlDoc.load and if the parameters changed since last poll then it changes things on the display.

Imagine the application is a dynamic display of chess board in a tournamemt.
MyApp then draws the chess board and sets up the pieces in initial order.
Then it polls for "moves" by Black or White and if a new move was made then it re-draws the board as needed.
Richard QuadlingSenior Software DeveloperCommented:
So how did it all go?
pfefferlAuthor Commented:
a) I tested the application without any changes and now it doesn't cache - i.e. it works. That is normally good but in this case there may be an "intermittemt caching problem" (sometimes caching and sometimes not) and that is more difficult to resolve. Sort of like certian problems in real-time systems where problems can be intermittent. If the problem persists I suspect ther may be another system between the Apache server and the IE browser. One possible suspect is a firewall - I have to speak to its administrator to see if it can somehow intermittently cache. As far as I understand Apache parameters in its control file (httpd.conf) prevent caching by proxy servers - which I firsdt thought may be the problem What is really puzzling (so far) is the intermittent nature of caching.

b) So far not clearwhat change to make to the PHP/Java scripts to further prevent caching. Your suggestion is good and sounds like it would prevent cached loading the PHP file (Myapp.php). Do you think it would also have an effect on the  xmlDoc.load function - and somehow cause it and the unerlying mecahnisms to prevent caching? If so I will try your suggestion if the system caches again XML file loads
Richard QuadlingSenior Software DeveloperCommented:
The way to get xmlDoc.load to work is to use the same mechanism.

Would this be suitable ...


The getanXML.php file will return the XML file.

What I'm not sure of is where the xml data is. You don't have to ASK for a .xml file. You make a request and the response is XML for the xmlDoc.load() function.

In PHP, you would use the header() function to set the appropriate content-type header and then send the XML data.

pfefferlAuthor Commented:
Hi Richard,

The XML file is in same directory on the Web seerver as the myapp.php script

If I understand correctly you suggest:

1) writing a PHP script called getanxml.php

2) refering to it in myapp.php by
    where 123 is the XML file prefix

3) getanxml.php would read the XML file and would return it to myapp.php via header()

If you think this could prevent caching of XML file reads I'll try it if the cache problem comes up again.

How would getanxml.php read the XML file. Also via xmlDoc.load?

Thanks for the patient help.

Richard QuadlingSenior Software DeveloperCommented:
If the XML file is fully formed (i.e. If the url had been www.site.com/file.xml) and that is all that is needed then ...

if ( isset($_GET['F']) && file_exists('./' . $_GET['F'] . '.xml') )
      header('Content-type: text/xml');
      header('Content-length: ' . filesize('./' . $_GET['F'] . '.xml'));
      $fp_xml = fopen('./' . $_GET['F'] . '.xml', 'rb');

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pfefferlAuthor Commented:
Sounds good & will try it.
Thanks for the help!
Richard QuadlingSenior Software DeveloperCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.