phpcachingmampphp-5.5

Stop caching for PHP 5.5.3 in MAMP


Installed MAMP on a new Macbook with PHP 5.5.3.

Reload and refresh do nothing. Still nothing. Google around for a few minutes trying to find out what is wrong, come back and refresh. It works. What the heck?

I went into php.ini and disabled all the new OPcache and set the default cache time to 0. Added headers to the document to force no caching. Still same problem. What the heck is going on here?

The network tab is showing a HTTP 200 request, so any new HTML in the index.php file renders fine, but new PHP that needs to be rendered by the server is delayed and not rendered until some predetermined set of time passes that I don't know how to change. What's going on?

I checked this in Safari too so it is definitely a server thing that is keeping the file from rendering.

Interesting fact though, if I go into MAMP and change the PHP version to the old one (PHP 5.2 or something) it will render normally, with no "caching issues". Switch to PHP 5.5 and it hangs up. In the MAMP preferences caching options for 5.5 don't even exist and are automatically disabled.


Solution

  • Disable OPCache

    MAMP now turns on OPCache by default, you can disable it by editing your php.ini file. Make sure you edit the correct php.ini.

    I was running into the same problem myself. MAMP with PHP version 5.5.3 runs OPcache by default, but you can't turn it off in the GUI like you can with the older PHP version 5.2.17. You have to manually comment out all the OPcache lines at the end of the php.ini file (MAMP/bin/php/[version]/conf/php.ini) and make sure to stop and start the servers for the changes to take effect.

    I updated the URI, the changes can be reflective by also changing /conf/ under the php folder, but it seems MAMP will ignore these after restart.