Web Development

PHP not Refreshing in Your Browser? Solution – Clear The Cache

Have you been working with PHP using MAMP/WAMP and made changes to your code but did not see those changes on the page?

The solution may be to clear the cache.

This was happening to me a lot and I thought it was an issue with my browser or computer.

I almost quit working with WordPress & PHP because I couldn’t figure out why this was happening and none of my teachers had the answer.

So I am making this post in case you are having this trouble, too.

It seems kind of obvious now, looking back, but the problem was with the cache.

Your browser saves images of the pages you have visited in a cache in order for them to load faster the next time you visit.

I have been hearing the word “cache” from the 90s but I always thought it was a security thing (like cookies), not an efficiency thing.

The issue with the cache when working on sites with PHP is that sometimes they do not refresh properly because the site is relying on the cache to load the page.

Here is what to do if that is happening to you:

We will use Chrome to talk about the solution, but all browsers have pretty obvious access to clearing the cache.

So in Chrome…

  1. Go to┬áthe word “Chrome” at the top left corner of your screen and select “Clear Browsing Data…” from the menu. A new tab will open with a popup that gives you a number of checkboxes to select or deselect.php site in browser not refreshing clear cache
  2. For the purposes of updating the pages of the site you’re are currently working on, make sure the checkmark next to “Cached images and files” is selected, and then click the “Clear Browsing Data” Button.php site in browser not refreshing clear cache 2