Page 1 of 1

localhost does reflect changes in source file structures

PostPosted: 14. April 2017 04:45
by Ironwolf
Hi, and thanks for any thoughts..

As a learner I am testing creating web pages using php files on localhost using XAMPP.

To check I understand file paths correctly i added a simple link to a pic in Index.php in htdocs:

<img src="/imagesxxx/inside_images/test-image-1.jpg" width="150" height="100" alt="test image 1" >

and it worked fine adding the image from the correct folder as had I placed it there.

To test I understand how the system works i moved test-image-1.jpg to another folder, then refreshed localhost, expecting
to find the picture place holder as localhost should have looked in the inside_images folder and not found the pic.
However, the picture still showed up as if all was correct.

I tried restarting my computer and going to localhost on Chrome, but still the picture showed up in the page as if it was in the correct folder.

What am I misunderstanding here?

Regards,
Stephen

Re: localhost does reflect changes in source file structures

PostPosted: 14. April 2017 07:26
by Ironwolf
CORRECTION: subject should read: "localhost does NOT reflect changes in source file structures"

Re: localhost does reflect changes in source file structures

PostPosted: 14. April 2017 08:03
by Altrea
Either it is cached or still accessible.

Re: localhost does reflect changes in source file structures

PostPosted: 14. April 2017 12:33
by Ironwolf
Thanks Altrea.
Yes that seems right. I tried going to Chrome history and deleting 'cached' images and files and it worked as expected.

Comment: given that the main purpose of XAMPP is to allow the quick testing of website pages and their supporting directory structure on your machine before you upload them to
a hosting site (I think that is the main idea), then having cached html/php docs or images affecting the processing of files in htdocs would seem to be a major flaw in the program's main purpose.

On the other hand I suppose the added step of deleting cached files before your final test is not that big a deal.

Maybe there is a SETTING somewhere which could stop cached files being activated for files processed by localhost?

Regards,
Ironwolf.

Re: localhost does reflect changes in source file structures

PostPosted: 15. April 2017 00:17
by Nobbie
Caching is done by your browser, not by Xampp. Xampp always sends the latest file, it is your browser which decides not to request the latest file. Even if there exist HTTP Header Options to tell the browser not to cache certain files, it is still the browser which may act as wanted or not. Therefore your comment looks kind of missplaced, as the browser is not part of Xampp.

Re: localhost does reflect changes in source file structures

PostPosted: 15. April 2017 04:14
by Ironwolf
Fair enough Nobbie.

Others coming upon this problem for the first time might find it useful to know:

Further research on caching, led me to find the Chrome extension: "Cache Killer" which seems an elegant solution to this problem. With one click you can force Chrome to clear the cache before loading any file. You can disable the extension to enable caching again when you have finished developing/testing. I tested it a couple of times and it works so far.

Regards,
Ironwolf.