php edits not displayed immediately when using MAM

2020-05-06 13:49发布

问题:

After changing php file and refreshing browser, the change is not displayed immediately, but refreshing after 15 seconds shows the change. However, changes display immediately for PHP Version 5.2.17, but not PHP Version 5.5.3.

phpinfo reports HTTP Response Headers has expires for php version 5.2.17, but not for php version 5.5.3.

Is this a known issue, and is there a fix in later version of php?

http.conf has:

  • LoadModule expires_module modules/mod_expires.so
  • ExpiresActive On
  • ExpiresDefault "now"

Using localhost MAMP in OSX Lion and Chrome browser.

Source code for test. Change number, hit refresh browser.

<?php
echo "Value is  4";
?>

回答1:

There is a cache, in your MAMP preferences if you use the php version 5.5.3. The same thing happen to me, I found the solution there: MAMP time between seeing live changes

In your MAMP Dir go to : /bin/php/php5.5.3/conf/php.ini
And comment the Opcahe lines:

[OPcache]
;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
;  opcache.enable_cli=1


标签: php mamp