Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Philip Powis
Philip Powis
7,625 Points

php caching?

I notice that when i make changes to my php files following along on the basic php project, I have to continuously refresh/wait a few minutes before the updates are reflected in the browser.

I assume the browser is caching the PHP code for a bit? Is there a way to keep the browser from doing this in a development environment?

Secondarily, I'm assuming there are benefits to the browser caching your code in a production environment, but are you as a developer able to exert any level of control over this?

Best,

Phil

5 Answers

Philip, you can hold down the shift button while clicking refresh and that should tell most browsers to pull a fresh copy instead of from cash. Another trick if you use Chrome as your browser, open up your inspector element (right click > inspect element or command+option+i on the mac), go to your settings (gear icon on the bottom right) one of the options should be Disable Cache (while DevTools is open), click that checkbox and that should help you.

I have tried all those tricks and even installed the Cache Killer plugin. It works great for most pages but the contact-process page is still getting cached. Any ideas?

Is this on a local server or a remote server?

Local. MAMP standard install on my Mac.

Can you tell me a little more about your setup? Handwritten php? Wordpress?