Jump to content

Template development: changes in template files not immediately visible in front-end


isellsoap
 Share

Recommended Posts

Setup:

  • PW version 2.7.1 dev
  • template cache is disabled
  • Chrome Canary is opened with disabled cache and in inkognito view mode

When I make a change to a template file (say the basic home.php) I want to immediately see that change after refreshing the browser. Example:

This is the content of home.php:

<?php

echo "bla";

I browse to the root page and see the "bla" output.

I change the code to

<?php

echo "bla1";

and save the file. After that I immediately reload the page in the browser and I don’t see the change to "bla1". Only after multiple browser reloads (at times also more than 20 reloads) and "hard" reloads does the change appear. 

What I tried to do:

  • set $config->dbCache, $config->sessionFingerprint and $config->sessionChallenge to false in config.php
  • delete all sessions
  • re-save the page in the ProcessWire backend and reload the browser page
  • completely delete the browser history (cookies, cache, everything) after the first visit to the page

Nothing helped.

Questions:

  • Can someone replicate this behavior?
  • What can I do to achieve the desired behavior?

Thanks a lot in advance for any help.

Link to comment
Share on other sites

That’s the solution, opcache is the "problem".

I turned it off by adding 

php_flag opcache.enable Off

to the .htaccess file during template development. Now every change is immediately visible in the front-end.

Amazing, thank you!  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...