The Gippy Pages


Beware MAMP's default Caching Settings

Mar 14, 2011 | Computers, Web Design & Development | By Shawn Parker

MAMP is a wonderful thing. It allows for quick setup of a LAMP stack just about anywhere. This makes it great for testing. However, the folks who manage MAMP are focusing MAMP’s default settings towards production use, not development use. This means that XCache is turned on by default and that means that there is variable caching and file-path caching going on (MAMP also includes the APC & EAccelerator extensions, which do very similar things, as well).

While enabling these caching settings is good for performance they’re not really good for development since both filesystem paths and interpreted code can be cached for periods of time. What made me notice was when a machine here in the office wasn’t honoring the new path to a renamed folder. The assets in this folder were all loaded via include statements using relative paths. Hard coded paths should not have been an issue, but for some reason the system kept looking for the files in their old location.

It took a while before I narrowed it down to the caching settings as a culprit. Once we turned off caching all together our changes were reflected immediately and all was right again with the world.

What you need to do

The modification is simple, its just a change to the MAMP preferences.

  1. Open MAMP
  2. Click the “Preferences” button or select “Preferences” from the MAMP menu
  3. Click on “PHP” in the tab-bar if its not already selected
  4. Change the “Cache” dropdown to be “––” so that no caching extension is used
  5. Click “OK” to save the changes
  6. Restart MAMP (click “Stop Servers” and then “Start Servers” once they’ve stopped)

Tagged as: apache, apc, cache, eaccelerator, lamp, mamp, mysql, php, xchache