Why refresh a page using MAMP

I just bought a new macbook pro and installed MAMP on it. All files are saved in the correct location / htdocs, and the first time I ran my PHP files, everything worked fine. Then, when I changed the script and ran it again, the browser did not reload the page, it displayed the old (cached?) Version of the file.

I tried to do a hard update, restarting the browser, another browser, restarting the server, but none of this works.

+7
source share
4 answers

The same thing happened to me a few months ago. Here's the solution that worked for me: Go to settings in MAMP and change the Apache port to 80 and MYSQL port to 3306, then restart the server and try loading your PHP.

+4
source

There is a cache in the MAMP settings if you are using php version 5.5.3. The same thing happens to me, I found a solution there: MAMP time between viewing live changes

In your MAMP Dir, go to: /bin/php/php5.5.3/conf/php.ini
And comment on 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 
+35
source

In addition to the answers related to addicted coding, and specific to people using MAMP PRO ... in current versions of MAMP PRO (I see on mamp.info that this is not an option on the free MAMP), you have the option to just disable the cache PHP

You can access it from the shortcut on the PHP tab in MAMP PRO. Or go to http://localhost:8888/MAMP/opcache.php# (change the host name and port according to your configuration).

enter image description here

It should also be noted that MAMP PRO (at least the latest versions) uses a dynamically created php.ini , so you cannot edit it on the local file system.

MAMP has the right to report editing files directly,

"You should always use the functions of the MAMP PRO template to edit the configuration files of the MAMP subsystem. If you change them bypassing MAMP PRO, your changes are most likely to be ignored or overwritten the next time the servers are started."

Instead, in MAMP PRO, go to FILE > Edit Template > PHP > [select the php version you wish to edit] and make the necessary changes. Of course, in the light of the information I gave above, this is really not necessary if you just want OPCACHE not to hold back your updated code output. Just disable OPCACHE in the interface.

You can also switch to using APC or XCache , as I have not noticed that none of them delay the update of code output.

+1
source

Possible answer: Stop caching for PHP 5.5.3 in MAMP

for me, just adding opcache_reset () worked ; to php scritp

0
source

All Articles