Breaking News
Home / Sys Admin / Mac / Howto disable MAMP PHP script cache?

Howto disable MAMP PHP script cache?

MAMP 2.2 uses OPCache to cache PHP scripts. So if you make a change to your PHP script, and execute the script in the browser, you will not see your change right away. Looking at the OPCache configuration in MAMP (as defined in php.ini), the cache timeout interval is set to 60 secs. So it caches for every 60 secs and reload the scripts. This can be issue for development since you would have to wait that long to test and see your changes. This caching can be turned off by modifying the OPcache interval for re-validation.

This parameter is defined in the php.ini file that comes with MAMP and is located at

/Applications/MAMP/bin/php/php5.5.3/conf/php.ini

Open this file in vi or any text editor and search for opcache.revalidate_freq and you would see that it is set to 60 as show below:

zend_extension=”/Applications/MAMP/bin/php/php5.5.3/lib/php/extensions/no-debug-non-zts-20121212/opcache.so”
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1

Now change that parameter to 0 as opcache.revalidate_freq=0

Save the file and restart MAMP and now you should be able to see your PHP script changes right away every time, no more caching.

Check Also

How to reload DNS Cache in Mac OSX?

In order to refresh the DNS cache in Mac OSX, execute the dscacheutil command with …

Advertisment ad adsense adlogger