1

So this is driving me a little nuts,

I'm working on a child theme of Luma and the design requires me to modify some of the catalog blocks, so I've copied over a .phtml file into my theme folder.

The file override works, I put the file in the correct folder within my theme, I modified the file slightly to add a class to one of the divs, I flushed my cache with cache:flush and saw the change reflected in my browser.

The issue is that any further changes I'm trying to make are not showing when I refresh the page again, I'm just getting a cached version of my first change.

I've tried every combination of flushing the cache, flushing the static files via the Magento back end, setup:static-content:deploy -f, you name it.

What's going on? I see that my pub/static/frontend folder and my view_preprocessed are being emptied when I use the flush the static files button, yet any changes like adding a class to a div in a phtml file won't show, only that very first time.

I can't continue developing my theme with this issue, what is the proper cache clearing process when working with phtml template files?

EXTRA INFO:

  • The site is in developer mode.

  • I've also tried saving changes to the general admin settings, such as changing the site name, because I read that forces the Varnish cache to clear, made no difference.

2 Answers 2

1

Try disabling this caches in your local:

 php bin/magento cache:disable block_html full_page layout

flush cache an then see if your changes are showing

2
  • Made no difference unfortunately. I ran the command and it did disabled those layers of caching, as I can see theu're listed as disabled in the admin area. I tried running cache:flush and deleting the static files after, no change. I can make XML changes no problem, and when I add a new template file to my theme for the first time, no problem, but then that template gets perma-cached.
    – Sam Assoum
    Sep 8, 2021 at 17:42
  • I have a similar problem: on my site changes in a controller class php file are not working. I have to run bin/magento setup:upgrade. Very strange, I do not know why.
    – Chequille
    Dec 2, 2021 at 19:17
1

My solution turned out to be running this command after every change to my .phtml files: ctlscript.sh restart php-fpm

For my server, which uses bitnami, the full command is sudo /opt/bitnami/ctlscript.sh restart php-fpm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.